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. LeetCode-97.交错字符串

    给定三个字符串 s1, s2, s3, 验证 s3 是否是由 s1 和 s2 交错组成的. 示例 1: 输入: s1 = "aabcc", s2 = "dbbca&quo ...

  2. ace -- 语法高亮

    Creating a Syntax Highlighter for Ace 给ace创建一个语法高亮 Creating a new syntax highlighter for Ace is extr ...

  3. PAT甲题题解-1081. Rational Sum (20)-模拟分数计算

    模拟计算一些分数的和,结果以带分数的形式输出注意一些细节即可 #include <iostream> #include <cstdio> #include <algori ...

  4. rethinking virtual network embedding..substrate support for path splitting and migration阅读笔记

    1.引言 网络虚拟化, 1.支持同一个底层网络有多种网络架构,每种架构定制一个应用或用户社区. 2.也可以让多个服务提供者在共同的物理基础设施上定制端到端的服务.如Voice over IP(VoIP ...

  5. Day Seven

    站立式会议 站立式会议内容总结 331 今天完成: 1.主页面 toolbar 菜单修改为点击弹出两个选项:新增计划和书籍 2.点击新增书籍跳转到文件管理器 home按钮为回退至上级目录,后退按钮为c ...

  6. Feature List

    我组最终决定所做的软件工程项目是Bing词典(UWP)的背单词模块,下面是初步定下的Feature List. 按用户场景变化顺序列举(假设是新用户): 1.用户可通过点击“背单词”标识或按钮进入背单 ...

  7. Beta阶段综合报告

    一. 敏捷冲刺每日报告 http://www.cnblogs.com/mia0502/p/7767628.html http://www.cnblogs.com/mia0502/p/7773872.h ...

  8. iOS之Block总结以及内存管理

    block定义 struct Block_descriptor { unsigned long int reserved; unsigned long int size; void (*copy)(v ...

  9. Linux 下安装nginx的总结 (之前写的有问题))

    1. 下载niginx的 tar包 下载路径 http://nginx.org/en/download.html 也可以直接使用命令下载 wget http://nginx.org/download/ ...

  10. BZOJ4628 BJOI2016IP地址(trie)

    离线,每次修改相当于对该规则的所有匹配点的值+1,考虑在trie上打加法标记和匹配标记,匹配标记不下传,加法标记下传遇到匹配标记时清空.注意是用b时刻前缀-a时刻前缀,而不是(a-1)时刻前缀,具体我 ...