comp.lang.ada
 help / color / mirror / Atom feed
From: Tony <truand.tony@gmail.com>
Subject: Aborting a call to Accept_Socket
Date: Tue, 21 Apr 2009 08:40:13 -0700 (PDT)
Date: 2009-04-21T08:40:13-07:00	[thread overview]
Message-ID: <44d6b044-3cb8-402c-9b1f-afe39f6a47ce@r33g2000yqn.googlegroups.com> (raw)

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.



             reply	other threads:[~2009-04-21 15:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21 15:40 Tony [this message]
2009-04-21 16:21 ` Aborting a call to Accept_Socket Dmitry A. Kazakov
2009-04-21 16:32   ` Tony
2009-04-21 17:34   ` Adam Beneschan
2009-04-21 19:02     ` sjw
2009-04-21 21:03 ` Maciej Sobczak
2009-04-21 23:24 ` anon
replies disabled

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