| 1 |
/*=* Global settings. |
| 2 |
* |
| 3 |
* package: Sockets.Multicast |
| 4 |
* intro: |
| 5 |
* The @code{Sockets.Multicast} allows the creation of IP multicast |
| 6 |
* sockets. |
| 7 |
=*/ |
| 8 |
|
| 9 |
/*=type Multicast_Socket_FD |
| 10 |
* |
| 11 |
* what: IP multicast socket object |
| 12 |
* def: new Socket_FD with private |
| 13 |
* doc: |
| 14 |
* The @code{Multicast_Socket_FD} tagged type derives from the |
| 15 |
* @code{Socket_FD} type. It gets initialized by calling |
| 16 |
* @ref{Create_Multicast_Socket (function)}. An uninitialized |
| 17 |
* @code{Multicast_Socket_FD} can be successfully compared to |
| 18 |
* @code{Null_Multicast_Socket_FD}. |
| 19 |
=*/ |
| 20 |
|
| 21 |
/*=subprogram Create_Multicast_Socket |
| 22 |
* |
| 23 |
* what: Create an IP multicast socket |
| 24 |
* kind: function |
| 25 |
* arg: Group, in, String,, IP address of the multicast group to join |
| 26 |
* arg: Port, in, Natural,, Port of the multicast group to join |
| 27 |
* arg: TTL, in, Positive, 16, Time-to-live of sent packets |
| 28 |
* arg: |
| 29 |
* Self_Loop, in, Boolean, True, Should the socket receive the packets |
| 30 |
* sent from the local host? |
| 31 |
* arg: Local_If, in, String, "0.0.0.0", Address of the local interface |
| 32 |
* to use, or "0.0.0.0" to designate any possible interface |
| 33 |
* ret: Multicast_Socket_FD, The new initialized multicast socket |
| 34 |
* doc: |
| 35 |
* This function creates an IP multicast socket attached to a given |
| 36 |
* group, identified by its class E IP address and port. |
| 37 |
* |
| 38 |
* Be careful when choosing the TTL parameter of your IP multicast |
| 39 |
* socket. Most IP multicast routers do implement threshold-based |
| 40 |
* filtering and will not let IP multicast packets leave your |
| 41 |
* organization if the TTL on the last router is smaller than 16. |
| 42 |
* |
| 43 |
* If 0 is given for the Port, a local one will be chosen. It can |
| 44 |
* then later be retrieved using Get_Sock_Port. |
| 45 |
* concept: Creating a socket |
| 46 |
* concept: Creating a multicast socket |
| 47 |
* example: |
| 48 |
* $ declare |
| 49 |
* $ Sock : Multicast_Socket_FD; |
| 50 |
* $ begin |
| 51 |
* $ -- Create a multicast socket on group 224.1.2.3 port 8763 |
| 52 |
* $ Sock := Create_Multicast_Socket ("224.1.2.3", 8763); |
| 53 |
* $ -- Perform some operations on socket |
| 54 |
* $ [...] |
| 55 |
* $ -- Shutdown the socket in both directions |
| 56 |
* $ Shutdown (Sock, Both); |
| 57 |
* $ end; |
| 58 |
* see: Send (procedure) |
| 59 |
* see: Shutdown (procedure) |
| 60 |
=*/ |
| 61 |
|
| 62 |
/*=subprogram Create_Multicast_Socket |
| 63 |
* |
| 64 |
* what: Create an IP multicast socket |
| 65 |
* kind: function |
| 66 |
* arg: Group, in, String,, IP address of the multicast group to join |
| 67 |
* arg: Port, in, Positive,, Port of the multicast group to join |
| 68 |
* arg: Local_Port, in, Natural,, Local port number to use |
| 69 |
* arg: TTL, in, Positive, 16, Time-to-live of sent packets |
| 70 |
* arg: Local_If, in, String, "0.0.0.0", Address of the local interface |
| 71 |
* to use, or "0.0.0.0" to designate any possible interface |
| 72 |
* ret: Multicast_Socket_FD, The new initialized multicast socket |
| 73 |
* doc: |
| 74 |
* This function creates an IP multicast socket attached to a given |
| 75 |
* group, identified by its class E IP address and port. If |
| 76 |
* Local_Port is 0, a free port will automatically be chosen by |
| 77 |
* your operating system. |
| 78 |
* |
| 79 |
* This function should be used when you want to send packets |
| 80 |
* to a multicast group without receiving any packet yourself. |
| 81 |
* concept: Creating a socket |
| 82 |
* concept: Creating a multicast socket |
| 83 |
* example: |
| 84 |
* $ declare |
| 85 |
* $ Sock : Multicast_Socket_FD; |
| 86 |
* $ begin |
| 87 |
* $ -- Create a multicast socket on group 224.1.2.3 port 8763 |
| 88 |
* $ Sock := Create_Multicast_Socket ("224.1.2.3", 8763); |
| 89 |
* $ -- Perform some operations on socket |
| 90 |
* $ [...] |
| 91 |
* $ -- Shutdown the socket in both directions |
| 92 |
* $ Shutdown (Sock, Both); |
| 93 |
* $ end; |
| 94 |
* see: Send (procedure) |
| 95 |
* see: Shutdown (procedure) |
| 96 |
=*/ |