来自n
的{{1}}的值,sockfd = 3
并且因为它调用了读取函数,它不会从读取函数中出来。打印读取开始行后,它仅在那里停止:
while(1)
{
if (n < 0)
{
printf("ERROR writing to socket");
}
else if(n == 0)
{
printf("Nothing");
}
printf(" read start n=%d\n ,sockfd = %d\n",n,sockfd);
n = read(sockfd,buffer,1024);
if (n < 0)
{ error("ERROR reading from socket");
}
printf("Reply= %s",buffer);
write_buf_to_file("/root/abc_regr/receive.txt",buffer);
}
return;