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
struct GMcastSocket
struct GMcastSocket
{
gint sockfd;
struct sockaddr sa;
guint ref_count;
GIOChannel* iochannel;
}; |
gnet_mcast_socket_new ()
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 ()
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 ()
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 ()
Close and delete a multicast socket.
gnet_mcast_socket_ref ()
Increment the reference counter of the GMcastSocket.
gnet_mcast_socket_unref ()
Remove a reference from the GMcastSocket. When reference count
reaches 0, the socket is deleted.
gnet_mcast_socket_join_group ()
Join the multicast group using the multicast socket. You should
only join one group per socket.
gnet_mcast_socket_leave_group ()
Leave the mulitcast group.
gnet_mcast_socket_send ()
Send the packet using the multicast socket.
gnet_mcast_socket_receive ()
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).