1.

while ()
{
struct sockaddr in_addr;
socklen_t in_len;
int infd;
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; in_len = sizeof in_addr;
infd = accept (sfd, &in_addr, &in_len);
if (infd == -)
{
if ((errno == EAGAIN) ||
(errno == EWOULDBLOCK))
{
/* We have processed all incoming
connections. */
break;
}
else
{
perror ("accept");
break;
}
} s = getnameinfo (&in_addr, in_len,
hbuf, sizeof hbuf,
sbuf, sizeof sbuf,
NI_NUMERICHOST | NI_NUMERICSERV);
if (s == )
{
printf("Accepted connection on descriptor %d "
"(host=%s, port=%s)\n", infd, hbuf, sbuf);
} /* Make the incoming socket non-blocking and add it to the
list of fds to monitor. */
s = make_socket_non_blocking (infd);
if (s == -)
abort (); event.data.fd = infd;
event.events = EPOLLIN | EPOLLET;
s = epoll_ctl (efd, EPOLL_CTL_ADD, infd, &event);
if (s == -)
{
perror ("epoll_ctl");
abort ();
}
}
continue;

http://blog.jobbole.com/93566/

http://blog.csdn.net/piao00lingping/article/details/48000955

第7月第20天 epoll的更多相关文章

  1. 腾讯云 CIF 工程效能峰会,10 月 19 - 20 日震撼来袭!

    近年来,依托于云计算的飞速发展,腾讯云云产品更新迅猛,云原生生态构建初具规模,越来越多的企业也开始寻求与深入数字化转型之路.但在摸索与实践中,企业往往会进入"伪上云"的误区.除了单 ...

  2. 第27月第18天 epoll lt et

    1. While the usage of epoll when employed as a level-triggered interface does have the same semantic ...

  3. 第26月第20天 springboot

    --------------------- 1.pom.xml中添加支持web的模块: <dependency> <groupId>org.springframework.bo ...

  4. 第19月第20天 UITableView:改变 TableHeaderView 的高度 获取目录大小

    1.UITableView:改变 TableHeaderView 的高度 CGRect newFrame = headerView.frame; newFrame.size.height = newF ...

  5. 第18月第20天 tensorflow安装

    1. # Mac OS X $ sudo easy_install pip # Mac OS X, CPU only: $ sudo easy_install --upgrade six $ sudo ...

  6. 第4月第20天 python re xls2lua

    1. import re replace_values = ['one', 'two', 'three'] replace_keys = [str(i) for i in xrange(1, 4)] ...

  7. 第11月第20天 sqlite3_open xcode mysql connector

    1. sqlite3_open 死锁 * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP frame ...

  8. 第10月第20天 afnetwork like MKNetworkEngine http post

    1. + (AFHTTPRequestOperation *)requestSellerWithCompletion:(requestFinishedCompletionBlock)successBl ...

  9. SAP月结操作讲解

    SAP月结操作讲解 https://wenku.baidu.com/view/ac6fe45d312b3169a451a4b9.html   步聚 操作内容 事务码 是否必须 操作时间 月/年结 1 ...

随机推荐

  1. shell 的 export命令

    export 功能说明:设置或显示环境变量.语 法:export [-fnp][变量名称]=[变量设置值]补充说明:在shell中执行程序时,shell会提供一组环境变量.export可新增,修改或删 ...

  2. React Router学习

    React Router教程 本教程引用马伦老师的的教程 React项目的可用的路由库是React-Router,当然这也是官方支持的.它也分为: react-router 核心组件 react-ro ...

  3. SCRUM 12.03

    第二轮迭代从今天起正式开始了.12月3日,我们举行了一次组会. 第一轮迭代结束时,我们意识到第二轮迭代需要实现的功能主要如下: 在下次迭代的时候实现对多个网站的信息进行比较取最优惠的选择,目前我们劲针 ...

  4. 20135202闫佳歆--week5 分析system_call中断处理过程--实验及总结

    week 5 实验:分析system_call中断处理过程 一.使用gdb跟踪分析一个系统调用内核函数(上周选择那一个系统调用)--getpid 复习视频: 如何实现? - 更新menu代码到最新版 ...

  5. 第二个Sprint冲刺第五天(燃尽图)

  6. Daily Scrum - 11/20

    好习惯的养成需要两个星期. ——砖家 今天我们小组又进行了一次愉快的例会,可以看到daily scrum在我们小组已经逐渐变成了每日的好习惯.首先对以下一些团队routine达成了共识: 1.spri ...

  7. 第九周PSP&进度条

    PSP 一.表格: D日期     C类型 C内容 S开始时间 E结束时间 I时间间隔 T净时间(mins) 预计花费时间(mins) 11月11号 讨论 讨论beta发布 09:00 09:54 1 ...

  8. Apache ActiveMQ 学习一

    Apache ActiveMQ 5.8.0 Java 7 support (compiled with jdk6 and validated with jdk7) apache-activemq-5. ...

  9. Linux命令(二十一) 改变文件所有权 chown 和 chgrp

    目录 1.命令简介 2.常用参数介绍 3.实例 4.直达底部 命令简介 一个文件属于特定的所有者,如果更改文件的属主或属组可以使用 chown 和 chgrp 命令. chown 命令可以将文件变更为 ...

  10. Android GridView数据绑定

    java代码构造个泛型数组用于存放item,作为title        List<Map<String, Object>> items = new ArrayList< ...