Re: Problem closing a socket while thread blocks in read()

From: Lorinczy Zsigmond / Domonyik Mariann (lzsiga_at_axelero.hu)
Date: 03/02/04


Date: Tue, 02 Mar 2004 19:44:46 +0100


Peter Ammon wrote:
>
> I have a child thread that's blocking in a read() on a TCP socket. At
> the same time, my main thread closes the socket via close(). When this
> happens, read() never returns in the child thread and the socket is not
> reported as closed to the other end until the program exits.

Why should you close the socket in the main thread?



Relevant Pages

  • Re: Problem closing a socket while thread blocks in read()
    ... >> I have a child thread that's blocking in a readon a TCP socket. ... So either the OP is using an unusual unix, ...
    (comp.unix.programmer)
  • Problem closing a socket while thread blocks in read()
    ... I have a child thread that's blocking in a readon a TCP socket. ... reported as closed to the other end until the program exits. ... That code never reports readas returning. ...
    (comp.unix.programmer)
  • Re: CAsyncSocket::DoCallBack, the ASSERT
    ... I don't have any child thread. ... the OnInitDialog() of my main dialog I ... with new operator and call a method Init, that will create the socket. ...
    (microsoft.public.vc.mfc)
  • Re: Problem closing a socket while thread blocks in read()
    ... my main thread closes the socket via close. ... This has been discussed to death, but the basic idea is that you can ... never be sure the child thread is actually blocking in the 'read' as opposed ...
    (comp.unix.programmer)
  • Re: recv blocks although socket is ready
    ... of the members of the interface in my network layer have blocking ... Only one has non-blocking semantics. ... call any socket operation and rely on the socket to block. ... Now I have to implement blocking myself in all other ...
    (microsoft.public.win32.programmer.networks)