<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>glibmm: Gio::SignalSocket Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="doxygen-extra.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">glibmm  <span id="projectnumber">2.60.0</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceGio.html">Gio</a></li><li class="navelem"><a class="el" href="classGio_1_1SignalSocket.html">SignalSocket</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="classGio_1_1SignalSocket-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">Gio::SignalSocket Class Reference<div class="ingroups"><a class="el" href="group__NetworkIO.html">Portable Network I/O Functionality</a></div></div> </div> </div><!--header--> <div class="contents"> <p><code>#include <giomm/socketsource.h></code></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:ab45069dc0f789fa8696cd5f046095071"><td class="memItemLeft" align="right" valign="top"><a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1connection.html">sigc::connection</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classGio_1_1SignalSocket.html#ab45069dc0f789fa8696cd5f046095071">connect</a> (const <a class="elRef" href="../../../libsigc++-2.0/reference/html/classsigc_1_1slot.html">sigc::slot</a>< bool, <a class="el" href="group__glibmmEnums.html#gabd96381793b70d4ae32c725926990918">Glib::IOCondition</a> >& slot, const <a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>< <a class="el" href="classGio_1_1Socket.html">Socket</a> >& socket, <a class="el" href="group__glibmmEnums.html#gabd96381793b70d4ae32c725926990918">Glib::IOCondition</a> condition, const <a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>< <a class="el" href="classGio_1_1Cancellable.html">Cancellable</a> >& cancellable=<a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>< <a class="el" href="classGio_1_1Cancellable.html">Cancellable</a> >(), int priority=<a class="el" href="namespaceGlib.html#a0c450f82b9e34689e2dda2038ba7834fa597ed3aa6067516c9c752896f3816b5e">Glib::PRIORITY_DEFAULT</a>)</td></tr> <tr class="memdesc:ab45069dc0f789fa8696cd5f046095071"><td class="mdescLeft"> </td><td class="mdescRight">Connects an I/O handler that watches a socket. <a href="#ab45069dc0f789fa8696cd5f046095071">More...</a><br /></td></tr> <tr class="separator:ab45069dc0f789fa8696cd5f046095071"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><dl class="since_2_42"><dt><b><a class="el" href="since_2_42.html#_since_2_42000013">Since glibmm 2.42:</a></b></dt><dd></dd></dl> </div><h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="ab45069dc0f789fa8696cd5f046095071"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1connection.html">sigc::connection</a> Gio::SignalSocket::connect </td> <td>(</td> <td class="paramtype">const <a class="elRef" href="../../../libsigc++-2.0/reference/html/classsigc_1_1slot.html">sigc::slot</a>< bool, <a class="el" href="group__glibmmEnums.html#gabd96381793b70d4ae32c725926990918">Glib::IOCondition</a> >& </td> <td class="paramname"><em>slot</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>< <a class="el" href="classGio_1_1Socket.html">Socket</a> >& </td> <td class="paramname"><em>socket</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="group__glibmmEnums.html#gabd96381793b70d4ae32c725926990918">Glib::IOCondition</a> </td> <td class="paramname"><em>condition</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>< <a class="el" href="classGio_1_1Cancellable.html">Cancellable</a> >& </td> <td class="paramname"><em>cancellable</em> = <code><a class="el" href="classGlib_1_1RefPtr.html">Glib::RefPtr</a>< <a class="el" href="classGio_1_1Cancellable.html">Cancellable</a> >()</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>priority</em> = <code><a class="el" href="namespaceGlib.html#a0c450f82b9e34689e2dda2038ba7834fa597ed3aa6067516c9c752896f3816b5e">Glib::PRIORITY_DEFAULT</a></code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Connects an I/O handler that watches a socket. </p> <div class="fragment"><div class="line"><span class="keywordtype">bool</span> io_handler(<a class="code" href="group__glibmmEnums.html#gabd96381793b70d4ae32c725926990918">Glib::IOCondition</a> io_condition) { ... }</div><div class="line"><a class="code" href="group__NetworkIO.html#ga73dc3243f51abce0a62424329724f510">Gio::signal_socket</a>().<a class="code" href="classGio_1_1SignalSocket.html#ab45069dc0f789fa8696cd5f046095071">connect</a>(<a class="codeRef" href="../../../libsigc++-2.0/reference/html/group__ptr__fun.html#ga9c80de72f656fb05e81fda622dddc863">sigc::ptr_fun</a>(& io_handler), socket, <a class="code" href="namespaceGlib.html#gabd96381793b70d4ae32c725926990918aa38ee764d957d52ccd85688c27778daf">Glib::IO_IN</a> | Glib::IO_OUT);</div></div><!-- fragment --><p> is equivalent to: </p><div class="fragment"><div class="line"><span class="keywordtype">bool</span> io_handler(<a class="code" href="group__glibmmEnums.html#gabd96381793b70d4ae32c725926990918">Glib::IOCondition</a> io_condition) { ... }</div><div class="line"><span class="keyword">const</span> <span class="keyword">auto</span> socket_source = <a class="code" href="classGlib_1_1Source.html#aeaffb039abf99982d7a89403bca71569">Gio::SocketSource::create</a>(socket, <a class="code" href="namespaceGlib.html#gabd96381793b70d4ae32c725926990918aa38ee764d957d52ccd85688c27778daf">Glib::IO_IN</a> | Glib::IO_OUT);</div><div class="line">socket_source->connect(<a class="codeRef" href="../../../libsigc++-2.0/reference/html/group__ptr__fun.html#ga9c80de72f656fb05e81fda622dddc863">sigc::ptr_fun</a>(& io_handler));</div><div class="line">socket_source->attach(<a class="code" href="classGlib_1_1MainContext.html#a1502cbed045a9fb27d18c6975e1d255d">Glib::MainContext::get_default</a>());</div></div><!-- fragment --><p>This method is not thread-safe. You should call it, or manipulate the returned <a class="elRef" href="../../../libsigc++-2.0/reference/html/structsigc_1_1connection.html">sigc::connection</a> object, only from the thread where the <a class="el" href="classGio_1_1SignalSocket.html">SignalSocket</a> object's MainContext runs.</p> <dl class="since_2_42"><dt><b><a class="el" href="since_2_42.html#_since_2_42000016">Since glibmm 2.42:</a></b></dt><dd></dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">slot</td><td>A slot to call when polling <em>socket</em> results in an event that matches <em>condition</em>. The event will be passed as a parameter to <em>slot</em>. If <code>io_handler()</code> returns <code>false</code> the handler is disconnected. </td></tr> <tr><td class="paramname">socket</td><td>The <a class="el" href="classGio_1_1Socket.html" title="Low-level socket object. ">Socket</a> object to watch. </td></tr> <tr><td class="paramname">condition</td><td>The conditions to watch for. </td></tr> <tr><td class="paramname">cancellable</td><td>A <a class="el" href="classGio_1_1Cancellable.html" title="Allows actions to be cancelled. ">Cancellable</a> object which can be used to cancel the source, which will cause the source to trigger, reporting the current condition (which is likely 0 unless cancellation happened at the same time as a condition change). You can check for this in the callback using <a class="el" href="classGio_1_1Cancellable.html#a47ce5f2f16541b7ae18bc5114b366d8c" title="Checks if a cancellable job has been cancelled. ">Cancellable::is_cancelled()</a>. </td></tr> <tr><td class="paramname">priority</td><td>The priority of the new event source. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>A connection handle, which can be used to disconnect the handler. </dd></dl> </div> </div> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Tue Mar 19 2019 09:56:42 for glibmm by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>