From: Simon Wright <simon@pushface.org>
Subject: Re: GNAT.sockets UDP Example
Date: 17 Nov 2002 12:38:24 +0000
Date: 2002-11-17T12:38:24+00:00 [thread overview]
Message-ID: <x7vvg2wnzgf.fsf@smaug.pushface.org> (raw)
In-Reply-To: 8a2dx5TkACB@lemmies.lb.bawue.de
lemchens@lemmies.lb.bawue.de (arvids lemchens) writes:
> If i try to compile it:
>
> -----
> ich@pc3:/transfer/ich2/ada/my/myrdate$ gnatmake -gnatf sendudp.adb
> gnatgcc -c -gnatf sendudp.adb
> sendudp.adb:10:11: warning: file name does not match unit name, should be "myrdate.adb"
> sendudp.adb:27:05: no candidate interpretations match the actuals:
> sendudp.adb:27:05: missing argument for parameter "To" in call to "send_socket" declared at g-socket.ads:653
> sendudp.adb:27:35: expected type "Ada.Streams.Stream_Element_Offset"
I don't know what you think this means -- if you look at the spec of
Send_Socket it says
procedure Send_Socket
(Socket : Socket_Type;
Item : Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
-- Transmit a message to another socket. Note that Last is set to
-- Item'First when socket has been closed by peer. This is not an
-- error and no exception is raised. Raise Socket_Error on error;
Last is an *out* parameter, which means you need to supply an actual
variable of the correct type.
Kahnung : Ada.Streams.Stream_Element_Array := (1, 2, 3);
Last : Ada.Streams.Stream_Element_Offset;
begin
Initialize (Process_Blocking_IO => False);
Address.Addr := Addresses (Get_Host_By_Name(Argument(1)), 1);
Address.Port := 37;
Create_Socket (Socket, Family_Inet, Socket_Datagram);
-- Rest from TCP
-- Connect_Socket (Socket, Address);
-- Channel := Stream (Socket);
Send_Socket (Socket, Kahnung, Last);
> sendudp.adb:27:35: found type "Ada.Streams.Stream_Element"
> sendudp.adb:27:35: ==> in call to "Send_Socket" at g-socket.ads:645
> gnatmake: "sendudp.adb" compilation error
When I correct this error I get (GCC-3.2, compiling with -bargs -E):
smaug.pushface.org[15]$ ./myrdate myrouter
Execution terminated by unhandled exception
Exception name: GNAT.SOCKETS.SOCKET_ERROR
Message: [107] Transport endpoint is not connected
Call stack traceback locations:
0x8062e3d 0x806350d 0x804a6d3 0x804a4f2 0x4003d27e
and I suspect maybe you need to call Bind_Socket??? -- hmm, now I get
smaug.pushface.org[16]$ ./myrdate myrouter
Execution terminated by unhandled exception
Exception name: GNAT.SOCKETS.SOCKET_ERROR
Message: [13] Permission denied
whereas
Send_Socket (Socket, Kahnung, Last, Address);
ends up with a constraint error. Oh well, I guess I need to get GDB
working now ...
next prev parent reply other threads:[~2002-11-17 12:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-15 21:48 GNAT.sockets UDP Example arvids lemchens
2002-11-16 11:27 ` David C. Hoos, Sr.
2002-11-17 11:29 ` arvids lemchens
2002-11-17 12:38 ` Simon Wright [this message]
2002-11-18 8:24 ` arvids lemchens
-- strict thread matches above, loose matches on Subject: below --
2002-11-17 13:26 David C. Hoos, Sr.
2002-11-18 8:09 ` arvids lemchens
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox