From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d0728b52f51f685e X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: copy constructor for sockets Date: 25 May 2004 06:10:00 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1085462076 1120 62.49.19.209 (25 May 2004 05:14:36 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Tue, 25 May 2004 05:14:36 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: controlnews3.google.com comp.lang.ada:810 Date: 2004-05-25T06:10:00+01:00 List-Id: 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.