当前位置: 技术问答>linux和unix
socket编程中accept()返回值出错?
来源: 互联网 发布时间:2016-11-24
本文导语: #include #include #include #include #include #include #include #include #include #include void *thr_fn(void *arg) { int size,j; char recv_buf[1024]; int *parg=(int *)arg; int new_fd=*parg; printf("new_fd=%dn",new_fd); while((size=read(new_fd...
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
void *thr_fn(void *arg)
{
int size,j;
char recv_buf[1024];
int *parg=(int *)arg;
int new_fd=*parg;
printf("new_fd=%dn",new_fd);
while((size=read(new_fd,recv_buf,1024))>0)
{
if(recv_buf[0]=='@')
break;
printf("Message from client(%d):%sn",size,recv_buf);
for(j=0;j
#include
#include
#include
#include
#include
#include
#include
#include
#include
void *thr_fn(void *arg)
{
int size,j;
char recv_buf[1024];
int *parg=(int *)arg;
int new_fd=*parg;
printf("new_fd=%dn",new_fd);
while((size=read(new_fd,recv_buf,1024))>0)
{
if(recv_buf[0]=='@')
break;
printf("Message from client(%d):%sn",size,recv_buf);
for(j=0;j