Description
McastSocket represents a multicast socket. Currently, this supports
only IP multicast. An McastSocket is a "child" of a UdpSocket. You
can cast a pointer to a McastSocket to a pointer to a UdpSocket and
then use the UDP functions.
Details
gnet_mcast_socket_new ()
GMcastSocket* gnet_mcast_socket_new (void); |
Create a new multicast socket with any available port. Use this
constructor when you are creating a new group and the port number
doesn't matter. If you want to receive packets from the group,
you will have to join it next.
gnet_mcast_socket_port_new ()
GMcastSocket* gnet_mcast_socket_port_new (gint port); |
Create a new multicast socket with the given port. If you know
the port of the group you will join, use this constructor. If you
want to receive packets from the group, you will have to join it,
using the full address, next.
gnet_mcast_socket_inetaddr_new ()
GMcastSocket* gnet_mcast_socket_inetaddr_new
(const GInetAddr *ia); |
Create a new multicast socket with the GInetAddr. If you know
the GInetAddr of the group you will join, use this constructor.
If you want to receive packets from the group, you will have to
join it next.
gnet_mcast_socket_delete ()
void gnet_mcast_socket_delete (GMcastSocket *ms); |
Close and delete a multicast socket.
gnet_mcast_socket_ref ()
void gnet_mcast_socket_ref (GMcastSocket *s); |
Increment the reference counter of the GMcastSocket.
gnet_mcast_socket_unref ()
void gnet_mcast_socket_unref (GMcastSocket *s); |
Remove a reference from the GMcastSocket. When reference count
reaches 0, the socket is deleted.
gnet_mcast_socket_join_group ()
gint gnet_mcast_socket_join_group (GMcastSocket *ms,
const GInetAddr *ia); |
Join the multicast group using the multicast socket. You should
only join one group per socket.
gnet_mcast_socket_leave_group ()
gint gnet_mcast_socket_leave_group (GMcastSocket *ms,
const GInetAddr *ia); |
Leave the mulitcast group.
gnet_mcast_socket_send ()
gint gnet_mcast_socket_send (GMcastSocket *ms,
const GUdpPacket *packet); |
Send the packet using the multicast socket.
gnet_mcast_socket_receive ()
gint gnet_mcast_socket_receive (GMcastSocket *ms,
GUdpPacket *packet); |
Receive a packet using the mcast socket.
gnet_mcast_socket_has_packet ()
gboolean gnet_mcast_socket_has_packet (const GMcastSocket *s); |
Test if the socket has a receive packet.
gnet_mcast_socket_is_loopback ()
gint gnet_mcast_socket_is_loopback (const GMcastSocket *ms); |
Check if the multicast socket has loopback enabled. If loopback
is enabled, you receive all the packets you send. Most people
don't want this.
gnet_mcast_socket_set_loopback ()
gint gnet_mcast_socket_set_loopback (GMcastSocket *ms,
gint b); |
Turn the loopback on or off. If loopback is on, when the process
sends a packet, it will automatically be looped back to the host.
If it is off, not only will this the process not receive datagrams
it sends, other processes on the host will not receive its
packets.
gnet_mcast_socket_to_udp_socket()
#define gnet_mcast_socket_to_udp_socket(MS) |
Convert a multicast socket to a UDP socket (since a multicast
socket is just a UDP socket with some special features).