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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,61ec2c598155da95 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Aborting a call to Accept_Socket Reply-To: no to spamers (No@email.given.org) References: <44d6b044-3cb8-402c-9b1f-afe39f6a47ce@r33g2000yqn.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Tue, 21 Apr 2009 23:24:13 GMT NNTP-Posting-Host: 12.64.152.68 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1240356253 12.64.152.68 (Tue, 21 Apr 2009 23:24:13 GMT) NNTP-Posting-Date: Tue, 21 Apr 2009 23:24:13 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:4551 Date: 2009-04-21T23:24:13+00:00 List-Id: You must use the Selectors routines in the Socket package. Then set the Timout parameter to 20 second in procedure Check_Selector. This routine will wait until an event has occured. Once returned then you can check the return value for the parameter Status to determine which one of the following three events has occured: Completed, Expired, or Aborted. -- Complete: one of the expected events occurred -- Expired: no event occurred before the expiration of the timeout -- Aborted: an external action cancelled the wait operation before -- any event occurred. In <44d6b044-3cb8-402c-9b1f-afe39f6a47ce@r33g2000yqn.googlegroups.com>, Tony writes: >I would like to abort a call to Accept_Socket() if no connection >request arrives within a specified time (20 seconds). For me, a quite >simple solution (perhaps not safe) is to use an asynchronous transfer >of control like this: >--**************************************************** > procedure Server is > ... > begin > GNAT.Sockets.Initialize; > ... > loop > ... > select > delay 20.0; > exit; > then abort > GNAT.Sockets.Accept_Socket (...); > end select; > ... > end loop ; > end Server; >--**************************************************** >The expecting behaviour was the end of the program after 20 seconds >(if no connection request arrives). I observe : after 20 seconds the >program will terminate only if a connection request arrives. >Is this behaviour correct? >Thanks.