Re: "connect'" returns before server "accept"s
- From: mwojcik@xxxxxxxxxxx (Michael Wojcik)
- Date: 11 Jan 2006 15:35:52 GMT
In article <ZqGvf.3224$ZA2.1957@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>, Joseph Dionne <jdionne@xxxxxxxxxxx> writes:
> chengiz@xxxxxxxxxxx wrote:
> > It seems even in a blocking socket world, "connect" can return
> > immediately if the server has been set to "listen" but has not called
> > "accept" yet.
>
> I typically create sockets to non blocking connects, using poll() to wait for
> the socket to become write ready, or time out -- which can be INFINITE is you
> wish.
A non-blocking connect and waiting for the socket to become ready for
writing has precisely the same effect as a blocking connect, for the
OP's purposes. The active-open socket will be ready for writing when
the handshake completes; it does not somehow wait for the server to
call accept (an event which is not signalled to the client).
Of course, if the client sends data before the server calls accept, it
can eventually fill the server's receive window and at that point it
will no longer be ready for writing.
--
Michael Wojcik michael.wojcik@xxxxxxxxxxxxxx
Some seem to live on credit as naturally as they breathe, and I remember
the surprise of one of these: "What! You don't owe anybody anything! Good
Lord! man, lend me half a sovereign." -- Arthur Ransome
.
- References:
- "connect'" returns before server "accept"s
- From: chengiz
- Re: "connect'" returns before server "accept"s
- From: Joseph Dionne
- "connect'" returns before server "accept"s
- Prev by Date: Re: Signal race conditions.
- Next by Date: Re: My first .a file, but linker can't resolve references
- Previous by thread: Re: "connect'" returns before server "accept"s
- Next by thread: Re: "connect'" returns before server "accept"s
- Index(es):
Relevant Pages
|