From: Simon Wright <simon@pushface.org>
Subject: Re: copy constructor for sockets
Date: 25 May 2004 06:10:00 +0100
Date: 2004-05-25T06:10:00+01:00 [thread overview]
Message-ID: <x7vbrkdgkif.fsf@smaug.pushface.org> (raw)
In-Reply-To: u7rsc.18451$af3.951022@attbi_s51
tmoran@acm.org writes:
> >> 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().
I was thinking of poll(2), which can be told to block indefinitely
until some event occurs: 'man 2 poll' says
poll is a variation on the theme of select. It specifies
an array of nfds structures of type
struct pollfd {
int fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
};
and a timeout in milliseconds. A negative value means
infinite timeout. The field fd contains a file descriptor
for an open file.
(etc)
> 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.
I think there could be a problem with this if there's some problem
such that the accept(2) fails immediately, I suppose you could raise
an exception in the rendezvous if so,
> One more thing: if the server does the Get_Line, that suggests
> there's only one Get_Line per accept(), ie, no persistent
> connections.
I don't see that, so long as the server hands on the connected socket?
--
Simon Wright 100% Ada, no bugs.
next prev parent reply other threads:[~2004-05-25 5:10 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
2004-05-25 5:10 ` Simon Wright [this message]
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