comp.lang.ada
 help / color / mirror / Atom feed
From: johnd@faac.com (John Dibbs)
Subject: Florist Socket Help
Date: 12 Jun 2003 13:35:31 -0700
Date: 2003-06-12T20:35:31+00:00	[thread overview]
Message-ID: <a2e525d7.0306121235.1937ac27@posting.google.com> (raw)

Thanks in advance.

Trying create a UDP broadcast sock using florist
In C

int sock;
int one=1;
struct hostent *host;
struct sockaddr_in name;

sock = socket(AF_INET, SOCK_DGRAM,0);
setsockopt(sock,SOL_SOCKET,SOL_BROADCAST, &one, sizeof(one));
host = gethostbyname("255.255.255.255");
bcopy((char *)host->h_addr, (char *)&name.sin_addr, host->h_length);
name.sin_port = 4321;

In Ada
function pdu_io_open_write(
   UDP_Send_Port   : in    STD.Integer_32_Type) return STD.Integer_32_Type
is
   package  PS    renames Posix.Sockets;
   package  PSI   renames Posix.Sockets.Internet;

   -- SSock_Name : Internet_Socket_Address declared in package body

   Send_Socket : Posix.IO.File_Descriptor;
   Socket_Info : PS.Socket_Address_Info_List;
 begin

   Send_Socket := PS.Create(
                     PSI.Internet_Protocol,
                     PS.Datagram_Socket, 0);

   PS.Set_Socket_Broadcast(Send_Socket, PS.Enabled);

   PS.Get_Socket_Address_Info("255.255.255.255", "", Socket_Info);

   PSI.Set_Internet_Port(SSock_Name,
                     Posix.Host_To_Network_Byte_Order(UDP_Send_Port));
   ?????????????????
   how do I get the data from info_list to sin_addr?

   PSI.Set_Internet_Port(SSock_Name,
                  Posix.Host_To_Network_Byte_Order(UDP_Send_Port));

 
   return (0);

end pdu_io_open_write;



                 reply	other threads:[~2003-06-12 20:35 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