|
problem with socket reading
I am not able to receive the message on socket in the current process when its waiting for its child to exit.
code looks something like below
//in one thread of the current process
//thread 1
===============================================
int numBytes = read(sockid,buf,SIZE); //Now the thread is blocked
================================================
//in another thread
//thread 2
=================================================
if((pid = fork()) == 0) // child process
{
exec(...);
}
else
{
waitpid(pid); //now the process is blocked for the child's exit
}
=================================================
In the above scenario, when child is executing and parent is blocked for child's exit, also when there is some message available on the socket descrtiptor for the first thread to read, I am not able to read that even after child's exit. so could somebody throw more light on the above scenario?
Thanks in advance
Swap007
|