The Sockets.Multicast allows the creation of IP multicast sockets.

 -- Sockets.Multicast.Multicast_Socket_FD: type Multicast_Socket_FD is new Socket_FD with private;
     The Multicast_Socket_FD tagged type derives from the Socket_FD type. It gets initialized by calling Create_Multicast_Socket (function). An uninitialized Multicast_Socket_FD can be succesfully compared to Null_Multicast_Socket_FD.

Create_Multicast_Socket (function)
----------------------------------

Purpose
     Create an IP multicast socket

Prototype
      -- Sockets.Multicast.Create_Multicast_Socket: function Create_Multicast_Socket (GROUP : String; PORT : Positive; TTL : Positive := 16; SELF_LOOP : Boolean := True; LOCAL_IF : String := 0.0.0.0)
     return Multicast_Socket_FD;

Parameters

     GROUP   in   IP address of the multicast group to join
     PORT   in   Port of the multicast group to join
     TTL   in   Time-to-live of sent packets
     SELF_LOOP   in   Should the socket receive the packets
     sent from the local host?
     LOCAL_IF   in   Address of the local interface
     to use

Return value
     The new initialized multicast socket

Description
     This function creates an IP multicast socket attached to a given group, identified by its class E IP address and port.

     Be careful when choosing the TTL parameter of your IP multicast socket. Most IP multicast routers do implement threshold-based filtering and will not let IP multicast packets leave your organization if the TTL on the last router is smaller than 16.

Example

          declare
             Sock : Multicast_Socket_FD;
          begin
             -- Create a multicast socket on group 224.1.2.3 port 8763
             Sock := Create_Multicast_Socket ("224.1.2.3", 8763);
             -- Perform some operations on socket
             [...]
             -- Shutdown the socket in both directions
             Shutdown (Sock, Both);
          end;

See also
     Send (procedure),
     Shutdown (procedure).

Create_Multicast_Socket (function)
----------------------------------

Purpose
     Create an IP multicast socket

Prototype
      -- Sockets.Multicast.Create_Multicast_Socket: function Create_Multicast_Socket (GROUP : String; PORT : Positive; LOCAL_PORT : Natural; TTL : Positive := 16; LOCAL_IF : String := 0.0.0.0)
     return Multicast_Socket_FD;

Parameters

     GROUP   in   IP address of the multicast group to join
     PORT   in   Port of the multicast group to join
     LOCAL_PORT   in   Local port number to use
     TTL   in   Time-to-live of sent packets
     LOCAL_IF   in   Address of the local interface
     to use

Return value
     The new initialized multicast socket

Description
     This function creates an IP multicast socket attached to a given group, identified by its class E IP address and port. If Local_Port is 0, a free port will automatically be chosen by your operating system.

     This function should be used when you want to send packets to a multicast group without receiving any packet yourself.

Example

          declare
             Sock : Multicast_Socket_FD;
          begin
             -- Create a multicast socket on group 224.1.2.3 port 8763
             Sock := Create_Multicast_Socket ("224.1.2.3", 8763);
             -- Perform some operations on socket
             [...]
             -- Shutdown the socket in both directions
             Shutdown (Sock, Both);
          end;

See also
     Send (procedure),
     Shutdown (procedure).