comp.lang.ada
 help / color / mirror / Atom feed
* GNAT.Sockets.Check_Selector
@ 2003-02-01 18:13 Ching Bon Lam
  2003-02-01 18:56 ` GNAT.Sockets.Check_Selector Ching Bon Lam
  0 siblings, 1 reply; 5+ messages in thread
From: Ching Bon Lam @ 2003-02-01 18:13 UTC (permalink / raw)


Hi

I've a problem. I've written a small program to test 
GNAT.Sockets.Check_Selector. After I've executed the program it immediately 
returns with a constraint error: raised CONSTRAINT_ERROR : g-
socket.adb:538. I think the selector_type is raising this. 

If it doesn't return a constraint error it will run, however, 
Check_Selector returns immediately and Accept_Socket will block instead of 
accepting a socket that is ready.

Any suggestions/answers/solutions to this is very appreciated.

With regards,
CBL

-----------------------------------------

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Streams; use Ada.Streams;
with GNAT.Sockets; use GNAT.Sockets;

procedure prototype1 is
   Selector   : Selector_Type;
   RSet, WSet : Socket_Set_Type;
   Address    : Sock_Addr_Type;
   CAddr      : Sock_Addr_Type;
   S          : Socket_Type;
   C          : Socket_Type;
   Status     : Selector_Status;
begin
   GNAT.Sockets.Initialize;

   Address.Addr := Any_Inet_Addr;
   Address.Port := 411;

   Create_Socket(S);
   Create_Socket(C);
   Bind_Socket(S, Address);
   Listen_Socket(S);

   Empty(RSet);
   Empty(WSet);

   Set(RSet, S);
   Create_Selector(Selector);

   loop
      Check_Selector(Selector, RSet, WSet, Status, Forever);

      Put_Line("Status: " & Selector_Status'Image(Status));
      Put_Line("Accepting");

      Accept_Socket(S, C, CAddr);

    	 -- <snip> do something with socket

      Close_Socket(C);
   end loop;

   Close_Selector(Selector);
   GNAT.Sockets.Finalize;
end prototype1;

---------------------------------------
Ching Bon Lam - Applied Phyiscs Student
c.lam@student.utwente.nl
---------------------------------------



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNAT.Sockets.Check_Selector
  2003-02-01 18:13 GNAT.Sockets.Check_Selector Ching Bon Lam
@ 2003-02-01 18:56 ` Ching Bon Lam
  2003-02-01 19:35   ` GNAT.Sockets.Check_Selector Pascal Obry
  0 siblings, 1 reply; 5+ messages in thread
From: Ching Bon Lam @ 2003-02-01 18:56 UTC (permalink / raw)


I forgot to add that the compiler is GNAT 3.14 and the OS is Win2k Pro.
The command to build is "gnatmake prototype1".



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNAT.Sockets.Check_Selector
  2003-02-01 18:56 ` GNAT.Sockets.Check_Selector Ching Bon Lam
@ 2003-02-01 19:35   ` Pascal Obry
  2003-02-01 20:40     ` GNAT.Sockets.Check_Selector Ching Bon Lam
  0 siblings, 1 reply; 5+ messages in thread
From: Pascal Obry @ 2003-02-01 19:35 UTC (permalink / raw)



Ching Bon Lam <holyhuora@hotmail.commmm> writes:

> I forgot to add that the compiler is GNAT 3.14 and the OS is Win2k Pro.
> The command to build is "gnatmake prototype1".

First thing to do is to upgrade to GNAT 3.15.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNAT.Sockets.Check_Selector
  2003-02-01 19:35   ` GNAT.Sockets.Check_Selector Pascal Obry
@ 2003-02-01 20:40     ` Ching Bon Lam
  2003-02-02  9:29       ` GNAT.Sockets.Check_Selector Pascal Obry
  0 siblings, 1 reply; 5+ messages in thread
From: Ching Bon Lam @ 2003-02-01 20:40 UTC (permalink / raw)


Thx, you are my saviour :)

My suspicion of a faulty Create_Selector subprogram was confirmed after i 
have taken a look at the new subprogram of version 3.15. But i didn't know 
how to rewrite the Check_Selector subprogram to not to use any 
selector_type and link it into my program. But it doesn't matter any more.

CBL


Pascal Obry <p.obry@wanadoo.fr> wrote in news:un0lfaj5d.fsf@wanadoo.fr:

> 
> Ching Bon Lam <holyhuora@hotmail.commmm> writes:
> 
>> I forgot to add that the compiler is GNAT 3.14 and the OS is Win2k Pro.
>> The command to build is "gnatmake prototype1".
> 
> First thing to do is to upgrade to GNAT 3.15.
> 
> Pascal.
> 




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: GNAT.Sockets.Check_Selector
  2003-02-01 20:40     ` GNAT.Sockets.Check_Selector Ching Bon Lam
@ 2003-02-02  9:29       ` Pascal Obry
  0 siblings, 0 replies; 5+ messages in thread
From: Pascal Obry @ 2003-02-02  9:29 UTC (permalink / raw)



Ching Bon Lam <holyhuora@hotmail.commmm> writes:

> Thx, you are my saviour :)

Good to know ;)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-02-02  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-01 18:13 GNAT.Sockets.Check_Selector Ching Bon Lam
2003-02-01 18:56 ` GNAT.Sockets.Check_Selector Ching Bon Lam
2003-02-01 19:35   ` GNAT.Sockets.Check_Selector Pascal Obry
2003-02-01 20:40     ` GNAT.Sockets.Check_Selector Ching Bon Lam
2003-02-02  9:29       ` GNAT.Sockets.Check_Selector Pascal Obry

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