摘要: UDP系统调用时序图简单的UDP例子/* ============================================================================ Name : UDPclient.c Author : vestinfo Version : 1.1 Copyright : Your copyright notice Description : A simple UDP client, Ansi-style =====================================================... 阅读全文
posted @ 2012-09-30 22:43 helloweworld 阅读(1126) 评论(0) 推荐(0) 编辑
摘要: TCP 套接字函数,系统调用时序图connect函数头文件:#include <sys/socket.h>原型:int connect(int sockfd, const struct sockaddr* servaddr, socklen_t addrlen);参数:sockfd是socket函数返回的套接字描述符,servaddr指向套接字地址结构的指针(理解为对端的地址), addrlen该结构的大小,可通过sizeof(struct sockaddr)获得。返回值:成功返回0,出错返回-1.功能:建立socket连接。备注:(1)client在调用connect前不必非得调 阅读全文
posted @ 2012-09-30 21:56 helloweworld 阅读(1327) 评论(4) 推荐(2) 编辑
摘要: 在main函数中,reread_config(0); 经过下面的分析,知reread_config(0);是将每个会话信息作为一个结点存于host_list中(一个会话信息包含默认信息和本会话特有信息,且本会话信息会覆盖默认的相同选项)。 void reread_config(int sig){ if( !read_config(vtun.cfg_file) ) { vtun_syslog(LOG... 阅读全文
posted @ 2012-09-30 13:44 helloweworld 阅读(525) 评论(0) 推荐(0) 编辑