From: Rob Mitchelmore <rob@perkinwarbeck.net>
Subject: Blocking and non-blocking sockets
Date: Mon, 14 Oct 2002 21:50:40 +0000 (UTC)
Date: 2002-10-14T21:50:40+00:00 [thread overview]
Message-ID: <p6amqugdjldt2pn3lj6dmk8hitri6i2be6@4ax.com> (raw)
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
reply other threads:[~2002-10-14 21:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox