上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 48 下一页
摘要: /* ============================================================================ Name : TCPserver.c Author : vestinfo Version : 1.1 Copyright : www.cnblogs.com/vestinfo Description : TCP server ============================================================================ */#include <... 阅读全文
posted @ 2012-10-04 16:17 helloweworld 阅读(180) 评论(0) 推荐(0) 编辑
摘要: /* ============================================================================ Name : TCPclient.c Author : vestinfo Version : 1.1 Copyright : www.cnblogs.com/vestinfo Description : TCP client ============================================================================ */#include <... 阅读全文
posted @ 2012-10-04 16:16 helloweworld 阅读(300) 评论(0) 推荐(0) 编辑
摘要: /* ============================================================================ Name : UDPserver.c Author : vestinfo Version : 1.1 Copyright : www.cnblogs.com/vestinfo Description : A simple UDP server, Ansi-style ====================================================================... 阅读全文
posted @ 2012-10-04 16:15 helloweworld 阅读(198) 评论(0) 推荐(0) 编辑
摘要: /* ============================================================================ Name : UDPclient.c Author : vestinfo Version : 1.1 Copyright : www.cnblogs.com/vestinfo Description : A simple UDP client, Ansi-style ====================================================================... 阅读全文
posted @ 2012-10-04 16:14 helloweworld 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 指针是什么?说白了就是存放地址的变量!#include <stdio.h>#include <unistd.h>#include <fcntl.h>int main(int argc, char* argv[]){ //初始化法一 char buff_first[4] = {'a', 'b', 'c'}; printf("buff_first %s\n", buff_first); buff_first[0] = 'd'; printf("buff_first ch 阅读全文
posted @ 2012-10-04 14:59 helloweworld 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 例1:#include <stdio.h>#include <unistd.h>int global_var = 1;int main(int argc, char* argv[]){ int var = 10; if(fork() == 0) { printf("child process global_var = %d var = %d\n", ++global_var, ++var); } printf("pid = %d global_var = %d var = %d\n", getpid(), global_var, 阅读全文
posted @ 2012-10-03 20:41 helloweworld 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 声明:原创,转载注明出处www.cnblogs.com/vestinfo/ write函数 头文件:#include <unistd.h> 原型:ssize_t write(int fd, const void* buf, size_t count); 参数:fd文件描述符;buf指向一段内存的指针;count想要写入fd的字节数。 返回值:正确返回实际写入fd的字节数;错误返回-1. 功能... 阅读全文
posted @ 2012-10-03 15:07 helloweworld 阅读(1307) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑
上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 48 下一页