2014年(41)
发布时间:2014-04-23 22:01:29
获取时间:#include <stdio.h>#include <time.h>int main(){ time_t t; struct tm *lt; t = time(NULL);//获取秒数计的时间//time(&t) lt = localtime(&t);//获取本地时间 printf("local time:%d/%d/%d.........【阅读全文】
发布时间:2014-04-23 21:21:44
client:#include <stdio.h>#include <sys/stat.h>#include <stdlib.h>#include <unistd.h>#include <errno.h>#include <string.h>#include <sys/types.h>#include <sys/socket.h>#include<netinet/in.h>int main(){ int opt = 1; socklen_t len = sizeof(len);&nbs.........【阅读全文】
发布时间:2014-04-23 21:14:39
一个select函数的例子#include <stdio.h>#include <time.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>int main(){ struct timeval tv; char buf[100] = "pig"; fd_set readfds; tv.tv_sec = 4; &nbs.........【阅读全文】