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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8bbf2dbc48e08e2f,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m73g2000cwd.googlegroups.com!not-for-mail From: "lekktu@gmail.com" Newsgroups: comp.lang.ada Subject: Question about Streams and UDP sockets using GNAT.Sockets Date: 18 Jul 2006 02:41:06 -0700 Organization: http://groups.google.com Message-ID: <1153215666.455584.201990@m73g2000cwd.googlegroups.com> NNTP-Posting-Host: 213.97.59.248 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1153215672 9101 127.0.0.1 (18 Jul 2006 09:41:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 18 Jul 2006 09:41:12 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m73g2000cwd.googlegroups.com; posting-host=213.97.59.248; posting-account=6KulzA0AAAAYgqXnq9bp1dTrVVTCLyvG Xref: g2news2.google.com comp.lang.ada:5753 Date: 2006-07-18T02:41:06-07:00 List-Id: Hi. I'm using GNAT GPL 2006 (20060522-34) on Windows XP. I'm trying to broadcast an UDP packet, with the following test code: ---------------------------------------------------------------------- with GNAT.Sockets; use GNAT.Sockets; procedure Test is Local_Port : constant Port_Type := 20769; Remote_Port : constant Port_Type := 20770; Address : Sock_Addr_Type; Socket : Socket_Type; Channel : Stream_Access; Local_Host : String := "127.0.0.1"; begin Initialize; Create_Socket (Socket, Family_Inet, Socket_Datagram); Set_Socket_Option (Socket, Socket_Level, (Broadcast, True)); Address.Addr := Inet_Addr (Local_Host); Address.Port := Local_Port; Bind_Socket (Socket, Address); Address.Addr := Broadcast_Inet_Addr; Address.Port := Remote_Port; Channel := Stream (Socket, Address); String'Write (Channel, "TEST"); -- sends "T", "E", "S", "T". Free (Channel); Close_Socket (Socket); Finalize; end Test; ---------------------------------------------------------------------- The trouble I'm having is not about sockets, but the streams vs. sockets interaction. The above code does not send one UDP packet, but four, one for each byte of the test message. What I'm doing wrong? Thanks, Juanma