Advertisement

Linux套接字编程 服 客端代码

阅读量:

代码是参考Linux下getaddrinfo文件中的示例
链接:https://man7.org/linux/man-pages/man3/getaddrinfo.3.html

服务器端

复制代码
    #include <stdio.h>
    #include <sys/types.h> //目录为/usr/include/sys/types.h
    #include <stdlib.h> //标准库定义
    #include <unistd.h> //定义了各种符号常量 和类型,并声明杂项功能
    #include <string.h> //字符串操作
    #include <sys/socket.h> //主套接字头文件
    #include <netdb.h> //网络数据库操作的定义
    
    #define BUF_SIZE 500
    
    int main(int argc, char* argv[])
    {
    	printf("\n\nsocket编程--服务器端 d:\n\n");
    
    	//addrinfo"地址信息"结构体
    	struct ad

全部评论 (0)

还没有任何评论哟~