reactor
2014-09-28 21:23:16 61 举报
socket tcp/ip epoll linux
作者其他创作
大纲/内容
bind
N
events[i].events&EPOLLIN != 0
thpoll_add_work
send error
thpoll_add_workfunction
accept
Y
ret = recv
for i to ret
errno == EGAIN
reset_oneshot
listen
发送成功,重新设置文件描述符
log error
epoll_ctlevents |= ~EPOLLOUTevents = EPOLLIN | EPOLLET | EPOLLONESHOT
写
ret 0
argv1: thpollargv2:functionargv3:fd.epollfd = epollfdfd.sockfd = sockfd
ret = 0
创建listenfd
ret 0
reset_read_oneshot
readfun
events[i].event&EPOLLOUT != 0
ret =send
closefd
setsockoptSO_REUSEADDR
读
epoll_ctl_add
errno == EAGAIN
i == listenfd
thpoll_init(5)
epoll_add listenfd(no oneshot)
0
add send epoll
epollout 发送数据
ret = epoll_wait
process data
events = EPOLLOUT | EPOLLET |EPOLLONESHOT
epoll_create
0 条评论
下一页