Chinaunix首页 | 论坛 | 博客
  • 博客访问: 309118
  • 博文数量: 214
  • 博客积分: 4258
  • 博客等级: 上校
  • 技术积分: 2021
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-02 09:16
个人简介

http://blog.csdn.net/ly21st http://ly21st.blog.chinaunix.net

文章分类

全部博文(214)

文章存档

2018年(16)

2015年(1)

2014年(2)

2012年(22)

2011年(173)

发布时间: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.........【阅读全文】

阅读(266) | 评论(0) | 转发(0)

发布时间: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.........【阅读全文】

阅读(182) | 评论(0) | 转发(0)

发布时间: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.........【阅读全文】

阅读(245) | 评论(0) | 转发(0)

发布时间:2011-09-20 21:33:17

8.1 概述 写一个长度为0的数据是可行的,这导致一个包含ip头部、8字节udp头部和没有数据的ip数据报。这也意味着对于数据报协议,recvfrom返回0也是可行的:它不代表对方已关闭了连接,这与tcp套接口上的read返回0的情形不同。由于udp是无连接的,这就没有诸如关闭udp连接之类的事情。8.8 验证接收到的响应 &.........【阅读全文】

阅读(329) | 评论(0) | 转发(0)

发布时间:2011-09-19 19:37:02

7.1 概述 获取和设置影响套接口的选项:1)函数getsockopt和setsockopt2)函数fcntl3)函数ioctl7.3 检查选项是否受支持并获取缺省值 /* include checkopts1 *//* *INDENT-OFF* */#include       "unp.h"#include  &nbs.........【阅读全文】

阅读(231) | 评论(0) | 转发(0)
给主人留下些什么吧!~~
留言热议
请登录后留言。

登录 注册