comp.lang.ada
 help / color / mirror / Atom feed
* Florist Socket Help
@ 2003-06-12 20:35 John Dibbs
  0 siblings, 0 replies; only message in thread
From: John Dibbs @ 2003-06-12 20:35 UTC (permalink / 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;



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-06-12 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-12 20:35 Florist Socket Help John Dibbs

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