
The @code{Sockets.Multicast} allows the creation of IP multicast
sockets.

@deftypefn Sockets.Multicast.Multicast_Socket_FD type Multicast_Socket_FD is new Socket_FD with private;
The @code{Multicast_Socket_FD} tagged type derives from the
@code{Socket_FD} type. It gets initialized by calling
@ref{Create_Multicast_Socket (function)}.

@end deftypefn

@menu
* Create_Multicast_Socket (function)::
                        Create an IP multicast socket
* Create_Multicast_Socket (function)::
                        Create an IP multicast socket
@end menu

@node Create_Multicast_Socket (function)
@unnumberedsubsec Create_Multicast_Socket (function)
@cindex Creating a socket
@cindex Creating a multicast socket

@table @sc
@item Purpose
Create an IP multicast socket
@item Prototype
@deftypefn Sockets.Multicast.Create_Multicast_Socket function Create_Multicast_Socket (@w{@var{Group} : String}; @w{@var{Port} : Positive}; @w{@var{TTL} : Positive := 16}; @w{@var{Self_Loop} : Boolean := True})@*@w{return Multicast_Socket_FD;}
@end deftypefn
@fnindex Sockets.Multicast.Create_Multicast_Socket

@item Parameters
@multitable {XXXXXXXX} {in out X} {XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}
@item @var{Group} @tab in @tab IP address of the multicast group to join
@item @var{Port} @tab in @tab Port of the multicast group to join
@item @var{TTL} @tab in @tab Time-to-live of sent packets
@item @var{Self_Loop} @tab in @tab Should the socket receive the packets
sent from the local host?
@end multitable

@item Return value
The new initialized multicast socket

@item 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.



@item Example
@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;
@end example


@item See also
@ref{Send (procedure)},@*@ref{Shutdown (procedure)}.

@end table

@node Create_Multicast_Socket (function)
@unnumberedsubsec Create_Multicast_Socket (function)
@cindex Creating a socket
@cindex Creating a multicast socket

@table @sc
@item Purpose
Create an IP multicast socket
@item Prototype
@deftypefn Sockets.Multicast.Create_Multicast_Socket function Create_Multicast_Socket (@w{@var{Group} : String}; @w{@var{Port} : Positive}; @w{@var{Local_Port} : Natural}; @w{@var{TTL} : Positive := 16})@*@w{return Multicast_Socket_FD;}
@end deftypefn
@fnindex Sockets.Multicast.Create_Multicast_Socket

@item Parameters
@multitable {XXXXXXXX} {in out X} {XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}
@item @var{Group} @tab in @tab IP address of the multicast group to join
@item @var{Port} @tab in @tab Port of the multicast group to join
@item @var{Local_Port} @tab in @tab Local port number to use
@item @var{TTL} @tab in @tab Time-to-live of sent packets
@end multitable

@item Return value
The new initialized multicast socket

@item 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.



@item Example
@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;
@end example


@item See also
@ref{Send (procedure)},@*@ref{Shutdown (procedure)}.

@end table


