Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > 02424cba585f0a532f3fa58b2c5b6746 > files > 49

lib64gnet-2.0-devel-2.0.8-1mdv2008.1.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Mcast</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GNet Network Library Reference Manual">
<link rel="up" href="libgnet-reference.html" title="GNet Library Reference">
<link rel="prev" href="gnet-udp.html" title="UDP">
<link rel="next" href="gnet-conn-http.html" title="GConnHttp">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="gnet-overview.html" title="GNet Overview">
<link rel="chapter" href="gnet-developers.html" title="GNet for developers">
<link rel="chapter" href="gnet-examples.html" title="GNet Examples">
<link rel="chapter" href="libgnet-reference.html" title="GNet Library Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnet-udp.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="libgnet-reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNet Network Library Reference Manual</th>
<td><a accesskey="n" href="gnet-conn-http.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id354324" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id355142" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gnet-mcast"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id354324"></a><span class="refentrytitle">Mcast</span>
</h2>
<p>Mcast &#8212; IP Multicast socket</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gnet.h&gt;


                    <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>;
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>*       <a href="gnet-mcast.html#gnet-mcast-socket-new">gnet_mcast_socket_new</a>               (void);
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>*       <a href="gnet-mcast.html#gnet-mcast-socket-new-with-port">gnet_mcast_socket_new_with_port</a>     (gint port);
<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>*       <a href="gnet-mcast.html#gnet-mcast-socket-new-full">gnet_mcast_socket_new_full</a>          (const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *iface,
                                                         gint port);
void                <a href="gnet-mcast.html#gnet-mcast-socket-delete">gnet_mcast_socket_delete</a>            (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
void                <a href="gnet-mcast.html#gnet-mcast-socket-ref">gnet_mcast_socket_ref</a>               (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
void                <a href="gnet-mcast.html#gnet-mcast-socket-unref">gnet_mcast_socket_unref</a>             (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
GIOChannel*         <a href="gnet-mcast.html#gnet-mcast-socket-get-io-channel">gnet_mcast_socket_get_io_channel</a>    (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
<a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a>*          <a href="gnet-mcast.html#gnet-mcast-socket-get-local-inetaddr">gnet_mcast_socket_get_local_inetaddr</a>
                                                        (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-join-group">gnet_mcast_socket_join_group</a>        (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-leave-group">gnet_mcast_socket_leave_group</a>       (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-get-ttl">gnet_mcast_socket_get_ttl</a>           (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-set-ttl">gnet_mcast_socket_set_ttl</a>           (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         gint ttl);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-send">gnet_mcast_socket_send</a>              (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         const gchar *buffer,
                                                         gint length,
                                                         const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *dst);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-receive">gnet_mcast_socket_receive</a>           (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         gchar *buffer,
                                                         gint length,
                                                         <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> **src);
gboolean            <a href="gnet-mcast.html#gnet-mcast-socket-has-packet">gnet_mcast_socket_has_packet</a>        (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-is-loopback">gnet_mcast_socket_is_loopback</a>       (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);
gint                <a href="gnet-mcast.html#gnet-mcast-socket-set-loopback">gnet_mcast_socket_set_loopback</a>      (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         gboolean enable);
#define             <a href="gnet-mcast.html#gnet-mcast-socket-to-udp-socket">gnet_mcast_socket_to_udp_socket</a>     (MS)
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id355142"></a><h2>Description</h2>
<p>
The Mcast module provides support for IP Multicast sockets.  IP
Multicast allows you to send one packet to many receivers at once.
Unfortunately, IP Multicast is not widely available.  IP Multicast is
built on UDP.
</p>
<p>
An IP Multicast socket is represented by a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> stucture.  To
create a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>, call <a href="gnet-mcast.html#gnet-mcast-socket-new"><code class="function">gnet_mcast_socket_new()</code></a>,
<a href="gnet-mcast.html#gnet-mcast-socket-new-with-port"><code class="function">gnet_mcast_socket_new_with_port()</code></a>, or <a href="gnet-mcast.html#gnet-mcast-socket-new-full"><code class="function">gnet_mcast_socket_new_full()</code></a>.
Then call <a href="gnet-mcast.html#gnet-mcast-socket-join-group"><code class="function">gnet_mcast_socket_join_group()</code></a> to join a multicast group.
To leave the group, call <a href="gnet-mcast.html#gnet-mcast-socket-leave-group"><code class="function">gnet_mcast_socket_leave_group()</code></a>.
</p>
<p>
Use <a href="gnet-mcast.html#gnet-mcast-socket-set-loopback"><code class="function">gnet_mcast_socket_set_loopback()</code></a> to set whether packets sent by
the host will also be received by the host.  Applications typically
disable loopback.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id355246"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id355256"></a><h3>
<a name="GMcastSocket"></a>GMcastSocket</h3>
<a class="indexterm" name="id355268"></a><pre class="programlisting">typedef struct _GMcastSocket GMcastSocket;</pre>
<p>
A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> structure represents a IP Multicast socket.  The
 implementation is hidden.  A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> is child of
 <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>.  Use <a href="gnet-mcast.html#gnet-mcast-socket-to-udp-socket"><code class="function">gnet_mcast_socket_to_udp_socket()</code></a> to safely cast
 a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> to a <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355337"></a><h3>
<a name="gnet-mcast-socket-new"></a>gnet_mcast_socket_new ()</h3>
<a class="indexterm" name="id355350"></a><pre class="programlisting"><a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>*       gnet_mcast_socket_new               (void);</pre>
<p>
Creates a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> bound to all interfaces and an arbitrary
 port.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>; NULL on error.

</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355405"></a><h3>
<a name="gnet-mcast-socket-new-with-port"></a>gnet_mcast_socket_new_with_port ()</h3>
<a class="indexterm" name="id355417"></a><pre class="programlisting"><a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>*       gnet_mcast_socket_new_with_port     (gint port);</pre>
<p>
Creates a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> bound to all interfaces and port <em class="parameter"><code>port</code></em>.
 If <em class="parameter"><code>port</code></em> is 0, an arbitrary port will be used.  Use this
 constructor if you know the port of the group you will join.  Most
 applications will use this constructor.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>port</code></em>&#160;:</span></td>
<td> port to bind to
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>; NULL on error.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355506"></a><h3>
<a name="gnet-mcast-socket-new-full"></a>gnet_mcast_socket_new_full ()</h3>
<a class="indexterm" name="id355518"></a><pre class="programlisting"><a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a>*       gnet_mcast_socket_new_full          (const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *iface,
                                                         gint port);</pre>
<p>
Creates a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> bound to interface <em class="parameter"><code>iface</code></em> and port <em class="parameter"><code>port</code></em>.
 If <em class="parameter"><code>iface</code></em> is NULL, all interfaces will be used.  If <em class="parameter"><code>port</code></em> is 0, an
 arbitrary port will be used.  To receive packets from this group,
 call <a href="gnet-mcast.html#gnet-mcast-socket-join-group"><code class="function">gnet_mcast_socket_join_group()</code></a> next.  Loopback is disabled by
 default.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>iface</code></em>&#160;:</span></td>
<td> interface to bind to (NULL for all interfaces)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>port</code></em>&#160;:</span></td>
<td> port to bind to (0 for an arbitrary port)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a new <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>; NULL on error.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355651"></a><h3>
<a name="gnet-mcast-socket-delete"></a>gnet_mcast_socket_delete ()</h3>
<a class="indexterm" name="id355664"></a><pre class="programlisting">void                gnet_mcast_socket_delete            (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Deletes a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>. Does nothing if <em class="parameter"><code>socket</code></em> is NULL.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>, or NULL
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355735"></a><h3>
<a name="gnet-mcast-socket-ref"></a>gnet_mcast_socket_ref ()</h3>
<a class="indexterm" name="id355747"></a><pre class="programlisting">void                gnet_mcast_socket_ref               (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Adds a reference to a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355812"></a><h3>
<a name="gnet-mcast-socket-unref"></a>gnet_mcast_socket_unref ()</h3>
<a class="indexterm" name="id355824"></a><pre class="programlisting">void                gnet_mcast_socket_unref             (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Removes a reference from a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.  A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> is
 deleted when the reference count reaches 0.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id355897"></a><h3>
<a name="gnet-mcast-socket-get-io-channel"></a>gnet_mcast_socket_get_io_channel ()</h3>
<a class="indexterm" name="id355910"></a><pre class="programlisting">GIOChannel*         gnet_mcast_socket_get_io_channel    (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Gets the <span class="type">GIOChannel</span> of a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.
</p>
<p>
 Use the channel with <code class="function">g_io_add_watch()</code> to check if the socket is
 readable or writable.  If the channel is readable, call
 <a href="gnet-mcast.html#gnet-mcast-socket-receive"><code class="function">gnet_mcast_socket_receive()</code></a> to receive a packet.  If the channel
 is writable, call <a href="gnet-mcast.html#gnet-mcast-socket-send"><code class="function">gnet_mcast_socket_send()</code></a> to send a packet.  This
 is not a normal giochannel - do not read from or write to it.
</p>
<p>
 Every <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> has one and only one <span class="type">GIOChannel</span>.  If you ref
 the channel, then you must unref it eventually.  Do not close the
 channel.  The channel is closed by GNet when the socket is
 deleted.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <span class="type">GIOChannel</span>.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356057"></a><h3>
<a name="gnet-mcast-socket-get-local-inetaddr"></a>gnet_mcast_socket_get_local_inetaddr ()</h3>
<a class="indexterm" name="id356070"></a><pre class="programlisting"><a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a>*          gnet_mcast_socket_get_local_inetaddr
                                                        (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Gets the local host's address from a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <a href="gnet-inetaddr.html#GInetAddr"><span class="type">GInetAddr</span></a>.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356153"></a><h3>
<a name="gnet-mcast-socket-join-group"></a>gnet_mcast_socket_join_group ()</h3>
<a class="indexterm" name="id356165"></a><pre class="programlisting">gint                gnet_mcast_socket_join_group        (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);</pre>
<p>
Joins a multicast group.  Join only one group per socket.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>inetaddr</code></em>&#160;:</span></td>
<td> address of the group
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 on success.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356254"></a><h3>
<a name="gnet-mcast-socket-leave-group"></a>gnet_mcast_socket_leave_group ()</h3>
<a class="indexterm" name="id356267"></a><pre class="programlisting">gint                gnet_mcast_socket_leave_group       (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *inetaddr);</pre>
<p>
Leaves a mulitcast group.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>inetaddr</code></em>&#160;:</span></td>
<td> address of the group
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 on success.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356355"></a><h3>
<a name="gnet-mcast-socket-get-ttl"></a>gnet_mcast_socket_get_ttl ()</h3>
<a class="indexterm" name="id356368"></a><pre class="programlisting">gint                gnet_mcast_socket_get_ttl           (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Gets the multicast time-to-live (TTL) of a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.  All IP
 multicast packets have a TTL field.  This field is decremented by
 a router before it forwards the packet.  If the TTL reaches zero,
 the packet is discarded.  The default value is sufficient for most
 applications.
</p>
<p>
 The table below shows the scope for a given TTL.  The scope is
 only an estimate.
</p>
<p>
 </p>
<div class="table">
<a name="id356412"></a><p class="title"><b>Table&#160;1.&#160;TTL and scope</b></p>
<div class="table-contents"><table summary="TTL and scope" border="1">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th align="left">TTL</th>
<th align="left">Scope</th>
</tr></thead>
<tbody>
<tr>
<td align="left">0</td>
<td align="left">node local</td>
</tr>
<tr>
<td align="left">1</td>
<td align="left">link local</td>
</tr>
<tr>
<td align="left">2-32</td>
<td align="left">site local</td>
</tr>
<tr>
<td align="left">33-64</td>
<td align="left">region local</td>
</tr>
<tr>
<td align="left">65-128</td>
<td align="left">continent local</td>
</tr>
<tr>
<td align="left">129-255</td>
<td align="left">unrestricted (global)</td>
</tr>
</tbody>
</table></div>
</div>
<p><br class="table-break"></p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the TTL (an integer between 0 and 255), -1 if the kernel
 default is being used, or an integer less than -1 on error.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356543"></a><h3>
<a name="gnet-mcast-socket-set-ttl"></a>gnet_mcast_socket_set_ttl ()</h3>
<a class="indexterm" name="id356556"></a><pre class="programlisting">gint                gnet_mcast_socket_set_ttl           (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         gint ttl);</pre>
<p>
Sets the time-to-live (TTL) default of a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.  Set the TTL
 to -1 to use the kernel default.  The default value is sufficient
 for most applications.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>ttl</code></em>&#160;:</span></td>
<td> value to set TTL to
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if successful.  

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356653"></a><h3>
<a name="gnet-mcast-socket-send"></a>gnet_mcast_socket_send ()</h3>
<a class="indexterm" name="id356665"></a><pre class="programlisting">gint                gnet_mcast_socket_send              (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         const gchar *buffer,
                                                         gint length,
                                                         const <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> *dst);</pre>
<p>
Sends data to a host using a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></td>
<td> buffer to send
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> length of buffer
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>dst</code></em>&#160;:</span></td>
<td> destination address
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if successful.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356803"></a><h3>
<a name="gnet-mcast-socket-receive"></a>gnet_mcast_socket_receive ()</h3>
<a class="indexterm" name="id356815"></a><pre class="programlisting">gint                gnet_mcast_socket_receive           (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         gchar *buffer,
                                                         gint length,
                                                         <a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a> **src);</pre>
<p>
Receives data using a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.  If <em class="parameter"><code>src</code></em> is set, the source
 address is stored in the location <em class="parameter"><code>src</code></em> points to.  The address is
 caller owned.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></td>
<td> buffer to write to
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> length of <em class="parameter"><code>buffer</code></em>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>src</code></em>&#160;:</span></td>
<td> pointer to source address (optional)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the number of bytes received, -1 if unsuccessful.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id356971"></a><h3>
<a name="gnet-mcast-socket-has-packet"></a>gnet_mcast_socket_has_packet ()</h3>
<a class="indexterm" name="id356984"></a><pre class="programlisting">gboolean            gnet_mcast_socket_has_packet        (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Tests if a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> has a packet waiting to be received.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if there is packet waiting, FALSE otherwise.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id357059"></a><h3>
<a name="gnet-mcast-socket-is-loopback"></a>gnet_mcast_socket_is_loopback ()</h3>
<a class="indexterm" name="id357072"></a><pre class="programlisting">gint                gnet_mcast_socket_is_loopback       (const <a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket);</pre>
<p>
Checks if a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> has loopback enabled.  If loopback is
 enabled, all packets sent by the host will also be received by the
 host.  Loopback is disabled by default.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if loopback is disabled, 1 if enabled, and -1 on error.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id357149"></a><h3>
<a name="gnet-mcast-socket-set-loopback"></a>gnet_mcast_socket_set_loopback ()</h3>
<a class="indexterm" name="id357162"></a><pre class="programlisting">gint                gnet_mcast_socket_set_loopback      (<a href="gnet-mcast.html#GMcastSocket">GMcastSocket</a> *socket,
                                                         gboolean enable);</pre>
<p>
Enables (or disables) loopback on a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>.  Loopback is
 disabled by default.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>enable</code></em>&#160;:</span></td>
<td> should loopback be enabled?
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> 0 if successful.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id357258"></a><h3>
<a name="gnet-mcast-socket-to-udp-socket"></a>gnet_mcast_socket_to_udp_socket()</h3>
<a class="indexterm" name="id357271"></a><pre class="programlisting">#define gnet_mcast_socket_to_udp_socket(MS) ((GUdpSocket*) (MS))
</pre>
<p>
Converts a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> to a <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>.  A <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a> is a
 child of <a href="gnet-udp.html#GUdpSocket"><span class="type">GUdpSocket</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>MS</code></em>&#160;:</span></td>
<td> a <a href="gnet-mcast.html#GMcastSocket"><span class="type">GMcastSocket</span></a>
</td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>