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,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dfddb85b5a048f08 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-17 04:38:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: GNAT.sockets UDP Example Date: 17 Nov 2002 12:38:24 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <8$vYrY3kACB@lemmies.lb.bawue.de> <8a2dx5TkACB@lemmies.lb.bawue.de> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1037536703 29521 62.49.19.209 (17 Nov 2002 12:38:23 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 17 Nov 2002 12:38:23 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:31000 Date: 2002-11-17T12:38:24+00:00 List-Id: 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 ...