【发布时间】:2017-06-13 08:39:58
【问题描述】:
void epoll_func(epoll_event event){
char str[BUFSIZE] = {'\0'};
int c =0;
if(event.data.fd == connfd && EPOLLIN){
while(true){
c = read( connfd, str, BUFSIZE);
write( 1, str, c);
if(c<BUFSIZE)
break;
}
}else if( event.data.fd == 0 && EPOLLIN ){
while(true){
c = read( 0, str, BUFSIZE);
send( connfd, str, c, 0);
if(c<BUFSIZE)
break;
}
}
}
给master写数据,也读到自己写的数据。怎么办?
非常感谢。
【问题讨论】:
-
欢迎来到 Stackoverflow!请花一些时间阅读the help pages,尤其是名为"What topics can I ask about here?" 和"What types of questions should I avoid asking?" 的部分。也请使用tour 并阅读有关how to ask good questions 的信息。最后请学习如何创建Minimal, Complete, and Verifiable Example。
-
看起来像 C。为什么要向 C++ 标签发送垃圾邮件?
-
0 && EPOLLIN可以更简单地表达 ;)