comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: copy constructor for sockets
Date: Mon, 24 May 2004 18:26:34 GMT
Date: 2004-05-24T18:26:34+00:00	[thread overview]
Message-ID: <u7rsc.18451$af3.951022@attbi_s51> (raw)
In-Reply-To: x7vvfinie2r.fsf@smaug.pushface.org

>> socket to the task during the rendezvous, and let the task create a socket
>> and do the socket-accept.
>I know you can use select() or poll() to block until an accept() would
>succeed, is that the idea?
  Yes.  Have the server task poll (frequently) to see if an accept() would
succeed, then rendezvous with the handler task which does the actual
accept().  Note the OP's Get_Line could take a very long time if the
caller is not a fast browser - a typist surfing with telnet www.x 80, say.
So having the server do the Get_Line allows such a single slow typist to
block all other new traffic.
  In this case, though, the server could start/call a task and not worry
about whether the task blocks on the accept().  If it does block, then
there's no browser calling and the server has nothing else to do anyway.
Eventually somebody surfs by, at which time the task hanging on the
accept() does the accept() and immediately finishes its rendezvous and the
server is allowed to go and prepare another acceptor task.
  The server is like a restaurant maitre d' - he should be minimizing
the time people wait at the door.  To do that he assigns them to a
waiter, who takes their drink order, tells them the daily specials, etc.
while the maitre d' turns his attention to the next customer in line.
  One more thing: if the server does the Get_Line, that suggests there's
only one Get_Line per accept(), ie, no persistent connections.



  reply	other threads:[~2004-05-24 18:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-22 21:18 copy constructor for sockets Andrew Carroll
2004-05-22 21:46 ` tmoran
2004-05-23 11:21   ` Simon Wright
2004-05-24 18:26     ` tmoran [this message]
2004-05-25  5:10       ` Simon Wright
2004-05-25  6:37         ` tmoran
2004-05-23  9:43 ` Mark Lorenzen
2004-05-23 11:27 ` Simon Wright
  -- strict thread matches above, loose matches on Subject: below --
2004-05-24 11:28 Andrew Carroll
2004-05-25  5:29 ` Simon Wright
2004-05-22 10:19 Andrew Carroll
2004-05-22 11:55 ` Simon Wright
2004-05-22 18:39   ` tmoran
2004-05-23 21:04   ` Matthew Heaney
2004-05-24  7:13     ` Marius Amado Alves
2004-05-24  3:23       ` Matthew Heaney
2004-05-24  4:53         ` Simon Wright
2004-05-24  5:20           ` tmoran
2004-05-25  4:53             ` Simon Wright
2004-05-24 12:36           ` Matthew Heaney
2004-05-25 21:50           ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox