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!news1.google.com!news.glorb.com!wn14feed!worldnet.att.net!attbi_s51.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: copy constructor for sockets References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 24.6.132.82 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s51 1085423194 24.6.132.82 (Mon, 24 May 2004 18:26:34 GMT) NNTP-Posting-Date: Mon, 24 May 2004 18:26:34 GMT Organization: Comcast Online Date: Mon, 24 May 2004 18:26:34 GMT Xref: controlnews3.google.com comp.lang.ada:803 Date: 2004-05-24T18:26:34+00:00 List-Id: >> 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.