I'm trying to connect two machines, say machine A and B. I'm trying to send TCP message from A to B (One way). In normal scenario this works fine. When the communication is smooth, if the socket in B is closed, send() from A is stuck forever. And it puts process into Zombie state. I have socket in blocked mode in machine A. Below is the code that stuck forever.
if (send (txSock,&txSockbuf,sizeof(sockstruct),0) == -1) {
printf ("Error in sending the socket Data\n");
}
else {
printf ("The SENT String is %s \n",sock_buf);
}
How do I find if the other side socket is closed?? What does send return if the destination socket is closed?? Would select be helpful.