http://blog.csdn.net/ly21st http://ly21st.blog.chinaunix.net
发布时间:2011-09-21 11:48:56
/* include readline */#include "unp.h"static int read_cnt;static char *read_ptr;static char read_buf[MAXLINE];static ssize_tmy_read(int fd, char *ptr){ if (read_cnt <= 0) {again: if ( (read_cnt = read(fd, read_buf, sizeof(read_buf))) < 0) {&n.........【阅读全文】
发布时间:2011-09-21 10:34:04
#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <netdb.h>#include <sys/types.h>#include <netinet/in.h>#include <sys/socket.h> //added by liyuan#include <netinet/in.h> //added by liyuan#include <arpa/inet.h> //added.........【阅读全文】
发布时间:2011-09-21 10:21:39
/* tcp4_10localip.c */#include <stdio.h> #include <string.h> #include <netdb.h> #include <arpa/inet.h> #include <netinet/in.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <net/if.h> #include <net/if_arp.h> #include <net/ethernet.h> #include <signal.h.........【阅读全文】
发布时间:2011-09-20 21:33:17
8.1 概述 写一个长度为0的数据是可行的,这导致一个包含ip头部、8字节udp头部和没有数据的ip数据报。这也意味着对于数据报协议,recvfrom返回0也是可行的:它不代表对方已关闭了连接,这与tcp套接口上的read返回0的情形不同。由于udp是无连接的,这就没有诸如关闭udp连接之类的事情。8.8 验证接收到的响应 &.........【阅读全文】