<!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"/> <title>GNU CommonC++: ost::SocketPort Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</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="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <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="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_socket_port.html">SocketPort</a> </div> </div> <div class="contents"> <h1>ost::SocketPort Class Reference</h1><!-- doxytag: class="ost::SocketPort" --><!-- doxytag: inherits="ost::Socket,ost::TimerPort" --> <p>The socket port is an internal class which is attached to and then serviced by a specific <a class="el" href="classost_1_1_socket_service.html" title="The SocketService is a thread pool object that is meant to service attached socket...">SocketService</a> "object". <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="socketport_8h_source.html">socketport.h</a>></code></p> <div class="dynheader"> Inheritance diagram for ost::SocketPort:</div> <div class="dynsection"> <div class="center"> <img src="classost_1_1_socket_port.png" usemap="#ost::SocketPort_map" alt=""/> <map id="ost::SocketPort_map" name="ost::SocketPort_map"> <area href="classost_1_1_socket.html" alt="ost::Socket" shape="rect" coords="0,0,95,24"/> <area href="classost_1_1_timer_port.html" alt="ost::TimerPort" shape="rect" coords="105,0,200,24"/> </map> </div> </div> <p><a href="classost_1_1_socket_port-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#ac70f9eae6b6b3625c980fa84180e8151">setTimer</a> (<a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timeout=0)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Derived setTimer to notify the service thread pool of change in expected timeout. <a href="#ac70f9eae6b6b3625c980fa84180e8151"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a1a7e2bf9e250ea5dcc9e8416aecfbb13">incTimer</a> (<a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timeout)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Derived incTimer to notify the service thread pool of a change in expected timeout. <a href="#a1a7e2bf9e250ea5dcc9e8416aecfbb13"></a><br/></td></tr> <tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a3e1456c5b19bb0dc58df0356c055709a">SocketPort</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc, <a class="el" href="classost_1_1_t_c_p_socket.html">TCPSocket</a> &tcp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct an accepted TCP socket connection from a specific bound TCP server. <a href="#a3e1456c5b19bb0dc58df0356c055709a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#aedfa5983eefe7e5bca5b3f4c4752ef88">SocketPort</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc, <a class="el" href="classost_1_1_t_c_p_v6_socket.html">TCPV6Socket</a> &tcp)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#ae48593fbe73189d452f62ac6864f832f">SocketPort</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc, const <a class="el" href="classost_1_1_i_p_v4_address.html">IPV4Address</a> &ia, <a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> port)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Construct a bound UDP socket for use in deriving realtime UDP streaming protocols handled by thread pool objects. <a href="#ae48593fbe73189d452f62ac6864f832f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#adf67a624a192a3eaffbf59891669b1bd">SocketPort</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc, const <a class="el" href="classost_1_1_i_p_v6_address.html">IPV6Address</a> &ia, <a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> port)</td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#ac30498e30cd95a8f91c395ebb6e6116a">SocketPort</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc, const <a class="el" href="classost_1_1_i_p_v4_host.html">IPV4Host</a> &ih, <a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> port)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">A non-blocking constructor for outbound tcp connections. <a href="#ac30498e30cd95a8f91c395ebb6e6116a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a0aee0992af4ffdbda14489ef094a89fd">SocketPort</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc, const <a class="el" href="classost_1_1_i_p_v6_host.html">IPV6Host</a> &ih, <a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> port)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#aed5fbff0b874da8e24add7f6cc50b65e">attach</a> (<a class="el" href="classost_1_1_socket_service.html">SocketService</a> *svc)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Attach yourself to the service pool thread object. <a href="#aed5fbff0b874da8e24add7f6cc50b65e"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a8c9fcdcd63fae060e12801ddf6ab12db">~SocketPort</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Disconnect the socket from the service thread pool and the remote connection. <a href="#a8c9fcdcd63fae060e12801ddf6ab12db"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a908891c78c95d66424cde91e52299c29">setDetectPending</a> (bool)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Used to indicate if the service thread should monitor pending data for us. <a href="#a908891c78c95d66424cde91e52299c29"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#af1e65f719e39f651ad8789183f8905c9">getDetectPending</a> (void) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current state of the DetectPending flag. <a href="#af1e65f719e39f651ad8789183f8905c9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a229b32cb2bf8a306b8882413748eb44c">setDetectOutput</a> (bool)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Used to indicate if output ready monitoring should be performed by the service thread. <a href="#a229b32cb2bf8a306b8882413748eb44c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a80a16072f163a5a49341c4fd495fd9b1">getDetectOutput</a> (void) const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Get the current state of the DetectOutput flag. <a href="#a80a16072f163a5a49341c4fd495fd9b1"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a4d09daed3fe5cb81259985db87add34d">expired</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Called by the service thread pool when the objects timer has expired. <a href="#a4d09daed3fe5cb81259985db87add34d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a5e0ec242cfb737db369cbc63abcc06b6">pending</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Called by the service thread pool when input data is pending for this socket. <a href="#a5e0ec242cfb737db369cbc63abcc06b6"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#af333abc3b9f8f8b2ce4d286d64d54848">output</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Called by the service thread pool when output data is pending for this socket. <a href="#af333abc3b9f8f8b2ce4d286d64d54848"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a7b2a739ee0cb11bc6332010f4cd21552">disconnect</a> (void)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Called by the service thread pool when a disconnect has occured. <a href="#a7b2a739ee0cb11bc6332010f4cd21552"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classost_1_1_socket.html#ae056b6dd4f167163083b7ab602fd3f3f">Error</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a3601785c16646b7e323cf2d267ce7481">connect</a> (const <a class="el" href="classost_1_1_i_p_v4_address.html">IPV4Address</a> &ia, <a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> port)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Connect a <a class="el" href="classost_1_1_socket.html" title="The Socket is used as the base for all Internet protocol services under Common C++...">Socket</a> Port to a known peer host. <a href="#a3601785c16646b7e323cf2d267ce7481"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classost_1_1_socket.html#ae056b6dd4f167163083b7ab602fd3f3f">Error</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a0edb8c155c97099cc0660b3ad1eef77f">connect</a> (const <a class="el" href="classost_1_1_i_p_v6_address.html">IPV6Address</a> &ia, <a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> port)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a9218e4528f5bdf4215200e2040eefe5b">send</a> (const void *buf, size_t len)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Transmit "send" data to a connected peer host. <a href="#a9218e4528f5bdf4215200e2040eefe5b"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a872c38a65b17113a580af345946146d7">receive</a> (void *buf, size_t len)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Receive a message from any host. <a href="#a872c38a65b17113a580af345946146d7"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">ssize_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#afb7798f8cc7e50d42ad82a1537e89c63">peek</a> (void *buf, size_t len)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Examine the content of the next packet. <a href="#afb7798f8cc7e50d42ad82a1537e89c63"></a><br/></td></tr> <tr><td colspan="2"><h2>Friends</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_socket_port.html#a4b89563fb4861da0276ccd214f93122d">SocketService</a></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>The socket port is an internal class which is attached to and then serviced by a specific <a class="el" href="classost_1_1_socket_service.html" title="The SocketService is a thread pool object that is meant to service attached socket...">SocketService</a> "object". </p> <p>Derived versions of this class offer specific functionality for specific protocols. Both Common C++ supporting frameworks and application objects may be derived from related protocol specific base classes.</p> <p>A special set of classes, "SocketPort" and "SocketService", exist for building realtime streaming media servers on top of UDP and TCP protocols. The "SocketPort" is used to hold a connected or associated TCP or UDP socket which is being "streamed" and which offers callback methods that are invoked from a "SocketService" thread. SocketService's can be pooled into logical thread pools that can service a group of SocketPorts. A millisecond accurate "timer" is associated with each <a class="el" href="classost_1_1_socket_port.html" title="The socket port is an internal class which is attached to and then serviced by a...">SocketPort</a> and can be used to time synchronize <a class="el" href="classost_1_1_socket_port.html" title="The socket port is an internal class which is attached to and then serviced by a...">SocketPort</a> I/O operations.</p> <dl class="author"><dt><b>Author:</b></dt><dd>David Sugar <<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>> base class for realtime and thread pool serviced protocols. </dd></dl> <dl><dt><b>Examples: </b></dt><dd> <p><a class="el" href="tcpservice_8cpp-example.html#_a1">tcpservice.cpp</a>.</p> </dd> </dl><hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a3e1456c5b19bb0dc58df0356c055709a"></a><!-- doxytag: member="ost::SocketPort::SocketPort" ref="a3e1456c5b19bb0dc58df0356c055709a" args="(SocketService *svc, TCPSocket &tcp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SocketPort::SocketPort </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classost_1_1_t_c_p_socket.html">TCPSocket</a> & </td> <td class="paramname"> <em>tcp</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Construct an accepted TCP socket connection from a specific bound TCP server. </p> <p>This is meant to derive advanced application specific TCP servers that can be thread pooled.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>svc</em> </td><td>pool thread object. </td></tr> <tr><td valign="top"></td><td valign="top"><em>tcp</em> </td><td>socket object to accept. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="aedfa5983eefe7e5bca5b3f4c4752ef88"></a><!-- doxytag: member="ost::SocketPort::SocketPort" ref="aedfa5983eefe7e5bca5b3f4c4752ef88" args="(SocketService *svc, TCPV6Socket &tcp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SocketPort::SocketPort </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classost_1_1_t_c_p_v6_socket.html">TCPV6Socket</a> & </td> <td class="paramname"> <em>tcp</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ae48593fbe73189d452f62ac6864f832f"></a><!-- doxytag: member="ost::SocketPort::SocketPort" ref="ae48593fbe73189d452f62ac6864f832f" args="(SocketService *svc, const IPV4Address &ia, tpport_t port)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SocketPort::SocketPort </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classost_1_1_i_p_v4_address.html">IPV4Address</a> & </td> <td class="paramname"> <em>ia</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> </td> <td class="paramname"> <em>port</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Construct a bound UDP socket for use in deriving realtime UDP streaming protocols handled by thread pool objects. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>svc</em> </td><td>pool thread object. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ia</em> </td><td>address of interface to bind. </td></tr> <tr><td valign="top"></td><td valign="top"><em>port</em> </td><td>number to bind to. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="adf67a624a192a3eaffbf59891669b1bd"></a><!-- doxytag: member="ost::SocketPort::SocketPort" ref="adf67a624a192a3eaffbf59891669b1bd" args="(SocketService *svc, const IPV6Address &ia, tpport_t port)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SocketPort::SocketPort </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classost_1_1_i_p_v6_address.html">IPV6Address</a> & </td> <td class="paramname"> <em>ia</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> </td> <td class="paramname"> <em>port</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="ac30498e30cd95a8f91c395ebb6e6116a"></a><!-- doxytag: member="ost::SocketPort::SocketPort" ref="ac30498e30cd95a8f91c395ebb6e6116a" args="(SocketService *svc, const IPV4Host &ih, tpport_t port)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SocketPort::SocketPort </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classost_1_1_i_p_v4_host.html">IPV4Host</a> & </td> <td class="paramname"> <em>ih</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> </td> <td class="paramname"> <em>port</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>A non-blocking constructor for outbound tcp connections. </p> <p>To detect when the connection is established, overload <a class="el" href="classost_1_1_socket_port.html#af333abc3b9f8f8b2ce4d286d64d54848" title="Called by the service thread pool when output data is pending for this socket.">SocketPort::output()</a>. <a class="el" href="classost_1_1_socket_port.html#af333abc3b9f8f8b2ce4d286d64d54848" title="Called by the service thread pool when output data is pending for this socket.">SocketPort::output()</a> get's called by the <a class="el" href="classost_1_1_socket_service.html" title="The SocketService is a thread pool object that is meant to service attached socket...">SocketService</a> when the connection is ready, <a class="el" href="classost_1_1_socket_port.html#a7b2a739ee0cb11bc6332010f4cd21552" title="Called by the service thread pool when a disconnect has occured.">SocketPort::disconnect()</a> when the connect failed. at the moment you should set the socket state to "CONNECTED" when <a class="el" href="classost_1_1_socket_port.html#af333abc3b9f8f8b2ce4d286d64d54848" title="Called by the service thread pool when output data is pending for this socket.">SocketPort::output()</a> get's called for the first time.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>svc</em> </td><td>pool thread object. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ih</em> </td><td>addess to connect to. </td></tr> <tr><td valign="top"></td><td valign="top"><em>port</em> </td><td>number to connect to. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a0aee0992af4ffdbda14489ef094a89fd"></a><!-- doxytag: member="ost::SocketPort::SocketPort" ref="a0aee0992af4ffdbda14489ef094a89fd" args="(SocketService *svc, const IPV6Host &ih, tpport_t port)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SocketPort::SocketPort </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classost_1_1_i_p_v6_host.html">IPV6Host</a> & </td> <td class="paramname"> <em>ih</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> </td> <td class="paramname"> <em>port</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a8c9fcdcd63fae060e12801ddf6ab12db"></a><!-- doxytag: member="ost::SocketPort::~SocketPort" ref="a8c9fcdcd63fae060e12801ddf6ab12db" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual ost::SocketPort::~SocketPort </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [protected, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Disconnect the socket from the service thread pool and the remote connection. </p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="aed5fbff0b874da8e24add7f6cc50b65e"></a><!-- doxytag: member="ost::SocketPort::attach" ref="aed5fbff0b874da8e24add7f6cc50b65e" args="(SocketService *svc)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ost::SocketPort::attach </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_socket_service.html">SocketService</a> * </td> <td class="paramname"> <em>svc</em></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Attach yourself to the service pool thread object. </p> <p>The later version.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>svc</em> </td><td>pool thread object </td></tr> </table> </dd> </dl> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a9">tcpservice.cpp</a>.</dd> </dl> </div> </div> <a class="anchor" id="a0edb8c155c97099cc0660b3ad1eef77f"></a><!-- doxytag: member="ost::SocketPort::connect" ref="a0edb8c155c97099cc0660b3ad1eef77f" args="(const IPV6Address &ia, tpport_t port)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classost_1_1_socket.html#ae056b6dd4f167163083b7ab602fd3f3f">Error</a> ost::SocketPort::connect </td> <td>(</td> <td class="paramtype">const <a class="el" href="classost_1_1_i_p_v6_address.html">IPV6Address</a> & </td> <td class="paramname"> <em>ia</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> </td> <td class="paramname"> <em>port</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <a class="anchor" id="a3601785c16646b7e323cf2d267ce7481"></a><!-- doxytag: member="ost::SocketPort::connect" ref="a3601785c16646b7e323cf2d267ce7481" args="(const IPV4Address &ia, tpport_t port)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classost_1_1_socket.html#ae056b6dd4f167163083b7ab602fd3f3f">Error</a> ost::SocketPort::connect </td> <td>(</td> <td class="paramtype">const <a class="el" href="classost_1_1_i_p_v4_address.html">IPV4Address</a> & </td> <td class="paramname"> <em>ia</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespaceost.html#a3c74a1a40c359fd349f3e3e1b96ebfc7">tpport_t</a> </td> <td class="paramname"> <em>port</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Connect a <a class="el" href="classost_1_1_socket.html" title="The Socket is used as the base for all Internet protocol services under Common C++...">Socket</a> Port to a known peer host. </p> <p>This is normally used with the UDP constructor. This is also performed as a non-blocking operation under Posix systems to prevent delays in a callback handler.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful. </dd></dl> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>ia</em> </td><td>address of remote host or subnet. </td></tr> <tr><td valign="top"></td><td valign="top"><em>port</em> </td><td>number of remote peer(s). </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a7b2a739ee0cb11bc6332010f4cd21552"></a><!-- doxytag: member="ost::SocketPort::disconnect" ref="a7b2a739ee0cb11bc6332010f4cd21552" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void ost::SocketPort::disconnect </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Called by the service thread pool when a disconnect has occured. </p> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a14">tcpservice.cpp</a>.</dd> </dl> </div> </div> <a class="anchor" id="a4d09daed3fe5cb81259985db87add34d"></a><!-- doxytag: member="ost::SocketPort::expired" ref="a4d09daed3fe5cb81259985db87add34d" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void ost::SocketPort::expired </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Called by the service thread pool when the objects timer has expired. </p> <p>Used for timed events. </p> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a10">tcpservice.cpp</a>.</dd> </dl> </div> </div> <a class="anchor" id="a80a16072f163a5a49341c4fd495fd9b1"></a><!-- doxytag: member="ost::SocketPort::getDetectOutput" ref="a80a16072f163a5a49341c4fd495fd9b1" args="(void) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ost::SocketPort::getDetectOutput </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline, protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Get the current state of the DetectOutput flag. </p> </div> </div> <a class="anchor" id="af1e65f719e39f651ad8789183f8905c9"></a><!-- doxytag: member="ost::SocketPort::getDetectPending" ref="af1e65f719e39f651ad8789183f8905c9" args="(void) const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ost::SocketPort::getDetectPending </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline, protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Get the current state of the DetectPending flag. </p> </div> </div> <a class="anchor" id="a1a7e2bf9e250ea5dcc9e8416aecfbb13"></a><!-- doxytag: member="ost::SocketPort::incTimer" ref="a1a7e2bf9e250ea5dcc9e8416aecfbb13" args="(timeout_t timeout)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ost::SocketPort::incTimer </td> <td>(</td> <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> </td> <td class="paramname"> <em>timeout</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Derived incTimer to notify the service thread pool of a change in expected timeout. </p> <p>This allows <a class="el" href="classost_1_1_socket_service.html" title="The SocketService is a thread pool object that is meant to service attached socket...">SocketService</a> to reschedule all timers. Otherwise same as <a class="el" href="classost_1_1_timer_port.html" title="Timer ports are used to provide synchronized timing events when managed under a "service...">TimerPort</a>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>in milliseconds. </td></tr> </table> </dd> </dl> <p>Reimplemented from <a class="el" href="classost_1_1_timer_port.html#ab2c732120c3bb09e8d38a87b7443906d">ost::TimerPort</a>.</p> </div> </div> <a class="anchor" id="af333abc3b9f8f8b2ce4d286d64d54848"></a><!-- doxytag: member="ost::SocketPort::output" ref="af333abc3b9f8f8b2ce4d286d64d54848" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void ost::SocketPort::output </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Called by the service thread pool when output data is pending for this socket. </p> </div> </div> <a class="anchor" id="afb7798f8cc7e50d42ad82a1537e89c63"></a><!-- doxytag: member="ost::SocketPort::peek" ref="afb7798f8cc7e50d42ad82a1537e89c63" args="(void *buf, size_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ssize_t ost::SocketPort::peek </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"> <em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline, protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Examine the content of the next packet. </p> <p>This can be used to build "smart" line buffering for derived TCP classes.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>buf</em> </td><td>pointer to packet buffer to examine. </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>of packet buffer to examine. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes actually available. </dd></dl> </div> </div> <a class="anchor" id="a5e0ec242cfb737db369cbc63abcc06b6"></a><!-- doxytag: member="ost::SocketPort::pending" ref="a5e0ec242cfb737db369cbc63abcc06b6" args="(void)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void ost::SocketPort::pending </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected, virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Called by the service thread pool when input data is pending for this socket. </p> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a11">tcpservice.cpp</a>.</dd> </dl> </div> </div> <a class="anchor" id="a872c38a65b17113a580af345946146d7"></a><!-- doxytag: member="ost::SocketPort::receive" ref="a872c38a65b17113a580af345946146d7" args="(void *buf, size_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ssize_t ost::SocketPort::receive </td> <td>(</td> <td class="paramtype">void * </td> <td class="paramname"> <em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline, protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Receive a message from any host. </p> <p>This is used in derived classes to build protocols.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>buf</em> </td><td>pointer to packet buffer to receive. </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>of packet buffer to receive. </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes received. </dd></dl> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a12">tcpservice.cpp</a>.</dd> </dl> </div> </div> <a class="anchor" id="a9218e4528f5bdf4215200e2040eefe5b"></a><!-- doxytag: member="ost::SocketPort::send" ref="a9218e4528f5bdf4215200e2040eefe5b" args="(const void *buf, size_t len)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ssize_t ost::SocketPort::send </td> <td>(</td> <td class="paramtype">const void * </td> <td class="paramname"> <em>buf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">size_t </td> <td class="paramname"> <em>len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [inline, protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Transmit "send" data to a connected peer host. </p> <p>This is not public by default since an overriding protocol is likely to be used in a derived class.</p> <dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes sent. </dd></dl> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>buf</em> </td><td>address of buffer to send. </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>of bytes to send. </td></tr> </table> </dd> </dl> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a13">tcpservice.cpp</a>.</dd> </dl> </div> </div> <a class="anchor" id="a229b32cb2bf8a306b8882413748eb44c"></a><!-- doxytag: member="ost::SocketPort::setDetectOutput" ref="a229b32cb2bf8a306b8882413748eb44c" args="(bool)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ost::SocketPort::setDetectOutput </td> <td>(</td> <td class="paramtype">bool </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Used to indicate if output ready monitoring should be performed by the service thread. </p> </div> </div> <a class="anchor" id="a908891c78c95d66424cde91e52299c29"></a><!-- doxytag: member="ost::SocketPort::setDetectPending" ref="a908891c78c95d66424cde91e52299c29" args="(bool)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ost::SocketPort::setDetectPending </td> <td>(</td> <td class="paramtype">bool </td> <td class="paramname"></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Used to indicate if the service thread should monitor pending data for us. </p> </div> </div> <a class="anchor" id="ac70f9eae6b6b3625c980fa84180e8151"></a><!-- doxytag: member="ost::SocketPort::setTimer" ref="ac70f9eae6b6b3625c980fa84180e8151" args="(timeout_t timeout=0)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ost::SocketPort::setTimer </td> <td>(</td> <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> </td> <td class="paramname"> <em>timeout</em> = <code>0</code></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Derived setTimer to notify the service thread pool of change in expected timeout. </p> <p>This allows <a class="el" href="classost_1_1_socket_service.html" title="The SocketService is a thread pool object that is meant to service attached socket...">SocketService</a> to reschedule all timers. Otherwise same as <a class="el" href="classost_1_1_timer_port.html" title="Timer ports are used to provide synchronized timing events when managed under a "service...">TimerPort</a>.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>in milliseconds. </td></tr> </table> </dd> </dl> <p>Reimplemented from <a class="el" href="classost_1_1_timer_port.html#a32b59a072fe60d94251a53579b3ca17f">ost::TimerPort</a>.</p> <dl><dt><b>Examples: </b></dt><dd><a class="el" href="tcpservice_8cpp-example.html#a8">tcpservice.cpp</a>.</dd> </dl> </div> </div> <hr/><h2>Friends And Related Function Documentation</h2> <a class="anchor" id="a4b89563fb4861da0276ccd214f93122d"></a><!-- doxytag: member="ost::SocketPort::SocketService" ref="a4b89563fb4861da0276ccd214f93122d" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">friend class <a class="el" href="classost_1_1_socket_service.html">SocketService</a><code> [friend]</code></td> </tr> </table> </div> <div class="memdoc"> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="socketport_8h_source.html">socketport.h</a></li> </ul> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Mar 12 10:07:41 2010 for GNU CommonC++ by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>