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,725d036543aaf71f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-14 14:51:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news-x2.support.nl!amsnews01.chello.com!news-hub.cableinet.net!blueyonder!btnet-peer!btnet-peer0!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: Rob Mitchelmore Newsgroups: comp.lang.ada Subject: Blocking and non-blocking sockets Date: Mon, 14 Oct 2002 21:50:40 +0000 (UTC) Organization: Triplet Software Message-ID: NNTP-Posting-Host: host213-122-12-208.in-addr.btopenworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: knossos.btinternet.com 1034632240 21095 213.122.12.208 (14 Oct 2002 21:50:40 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Mon, 14 Oct 2002 21:50:40 +0000 (UTC) X-Newsreader: Forte Free Agent 1.92/32.572 Xref: archiver1.google.com comp.lang.ada:29779 Date: 2002-10-14T21:50:40+00:00 List-Id: Hi: I'm not sure if this is a newbie question, but I'm having a problem with GNAT.Sockets (using GNAT for Win32 under XP). I'm aiming to create a listening socket which does a non-blocking Socket_Accept. When I create a blocking socket, Socket_Accept works as expected, blocking until a connection is received on the port, at which point execution continues, and I can use Stream(Client_Sock) and so forth. However, when I use Control_Socket to enable non-blocking mode for the socket, Socket_Accept still seems to block (or at least execution never continues past that call), accepting a connection and then leaving it 'hanging', never progressing past that point. Is there something I am doing gratuitously wrong here? Thanks very much, Rob -- snippet procedure Create_Server_Socket(Port : in Port_Type; Socket : out Socket_Type) is Address : Sock_Addr_Type; Nonblock : Request_Type(Non_Blocking_IO); begin Address.Addr := Inet_Addr("127.0.0.1"); Address.Port := Port; Create_Socket(Socket); Bind_Socket(Socket, Address); Listen_Socket(Socket); -- If I uncomment the following line, the problem appears: -- Nonblock.Enabled := true; Control_Socket(Socket, Nonblock); end Create_Server_Socket; -- end snippet