In one thread I am waiting for data in recv () call.

What kind of thread ? pthreads ? fork() ?

    Form other thread due to some reason I close socket
    on which recv () is waiting.

But recv () is not coming back from call.

I don't about pthreads, but a fork() will replicate the fds. So each thread has its own copy of socket fd.


Try this for fun :

sock = accept()
pid = fork()
if (pid)
   recv(sock)
else
   recv(sock)

Send some data to this socket. Check whether the parent process receives it or the child process.

    What should I do so that as soon as I close socket
    recv () will give error or come back from blocking
    state.


Some form of IPC ?

--Swapnil


"Theory is when you know something, but it doesn't work.Practice is when something works, but you don't know why.Programmers combine theory and practice: Nothing works and they don't know why ..."
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List: ([email protected])
List Information: http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.

Reply via email to