]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/module-doc/classInspSocket.html
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2578 e03df62e-2008...
[user/henk/code/inspircd.git] / docs / module-doc / classInspSocket.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>InspIRCd: InspSocket Class Reference</title>
4 <link href="inspircd.doxygen.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.4.4-20050815 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
8 <h1>InspSocket Class Reference</h1><!-- doxytag: class="InspSocket" -->InspSocket is an extendable socket class which modules can use for TCP socket support.  
9 <a href="#_details">More...</a>
10 <p>
11 <code>#include &lt;<a class="el" href="socket_8h-source.html">socket.h</a>&gt;</code>
12 <p>
13 Collaboration diagram for InspSocket:<p><center><img src="classInspSocket__coll__graph.gif" border="0" usemap="#InspSocket__coll__map" alt="Collaboration graph"></center>
14 <center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center><a href="classInspSocket-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
15 <tr><td></td></tr>
16 <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
17 <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#InspSocket_28_29">InspSocket</a> ()</td></tr>
18
19 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The default constructor does nothing and should not be used.  <a href="#InspSocket_28_29"></a><br></td></tr>
20 <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#InspSocket_28int_20newfd_2C_20char_20_2Aip_29">InspSocket</a> (int newfd, char *ip)</td></tr>
21
22 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor is used to associate an existing connecting with an InspSocket class.  <a href="#InspSocket_28int_20newfd_2C_20char_20_2Aip_29"></a><br></td></tr>
23 <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#InspSocket_28std_3A_3Astring_20host_2C_20int_20port_2C_20bool_20listening_2C_20unsigned_20long_20maxtime_29">InspSocket</a> (<a class="el" href="namespaceirc.html#string">std::string</a> <a class="el" href="classInspSocket.html#host">host</a>, int <a class="el" href="classInspSocket.html#port">port</a>, bool listening, unsigned long maxtime)</td></tr>
24
25 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor is used to create a new socket, either listening for connections, or an outbound connection to another host.  <a href="#InspSocket_28std_3A_3Astring_20host_2C_20int_20port_2C_20bool_20listening_2C_20unsigned_20long_20maxtime_29"></a><br></td></tr>
26 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnConnected_28_29">OnConnected</a> ()</td></tr>
27
28 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is called when an outbound connection on your socket is completed.  <a href="#OnConnected_28_29"></a><br></td></tr>
29 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a> (<a class="el" href="socket_8h.html#InspSocketError">InspSocketError</a> e)</td></tr>
30
31 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method is called when an error occurs.  <a href="#OnError_28InspSocketError_20e_29"></a><br></td></tr>
32 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnDisconnect_28_29">OnDisconnect</a> ()</td></tr>
33
34 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When an established connection is terminated, the OnDisconnect method is triggered.  <a href="#OnDisconnect_28_29"></a><br></td></tr>
35 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnDataReady_28_29">OnDataReady</a> ()</td></tr>
36
37 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When there is data waiting to be read on a socket, the <a class="el" href="classInspSocket.html#OnDataReady_28_29">OnDataReady()</a> method is called.  <a href="#OnDataReady_28_29"></a><br></td></tr>
38 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnTimeout_28_29">OnTimeout</a> ()</td></tr>
39
40 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When an outbound connection fails, and the attempt times out, you will receive this event.  <a href="#OnTimeout_28_29"></a><br></td></tr>
41 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnClose_28_29">OnClose</a> ()</td></tr>
42
43 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Whenever close() is called, <a class="el" href="classInspSocket.html#OnClose_28_29">OnClose()</a> will be called first.  <a href="#OnClose_28_29"></a><br></td></tr>
44 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#Read_28_29">Read</a> ()</td></tr>
45
46 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reads all pending bytes from the socket into a char* array which can be up to 16 kilobytes in length.  <a href="#Read_28_29"></a><br></td></tr>
47 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceirc.html#string">std::string</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#GetIP_28_29">GetIP</a> ()</td></tr>
48
49 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the IP address associated with this connection, or an empty string if no IP address exists.  <a href="#GetIP_28_29"></a><br></td></tr>
50 <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#Timeout_28time_5Ft_20current_29">Timeout</a> (time_t current)</td></tr>
51
52 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This function checks if the socket has timed out yet, given the current time in the parameter.  <a href="#Timeout_28time_5Ft_20current_29"></a><br></td></tr>
53 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#Write_28std_3A_3Astring_20data_29">Write</a> (<a class="el" href="namespaceirc.html#string">std::string</a> data)</td></tr>
54
55 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Writes a <a class="el" href="namespaceirc.html#string">std::string</a> to the socket.  <a href="#Write_28std_3A_3Astring_20data_29"></a><br></td></tr>
56 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#OnIncomingConnection_28int_20newfd_2C_20char_20_2Aip_29">OnIncomingConnection</a> (int newfd, char *ip)</td></tr>
57
58 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">If your socket is a listening socket, when a new connection comes in on the socket this method will be called.  <a href="#OnIncomingConnection_28int_20newfd_2C_20char_20_2Aip_29"></a><br></td></tr>
59 <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#SetState_28InspSocketState_20s_29">SetState</a> (<a class="el" href="socket_8h.html#InspSocketState">InspSocketState</a> s)</td></tr>
60
61 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Changes the socket's state.  <a href="#SetState_28InspSocketState_20s_29"></a><br></td></tr>
62 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="socket_8h.html#InspSocketState">InspSocketState</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#GetState_28_29">GetState</a> ()</td></tr>
63
64 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the current socket state.  <a href="#GetState_28_29"></a><br></td></tr>
65 <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#Poll_28_29">Poll</a> ()</td></tr>
66
67 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Only the core should call this function.  <a href="#Poll_28_29"></a><br></td></tr>
68 <tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#GetFd_28_29">GetFd</a> ()</td></tr>
69
70 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method returns the socket's file descriptor as assigned by the operating system, or -1 if no descriptor has been assigned.  <a href="#GetFd_28_29"></a><br></td></tr>
71 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#Close_28_29">Close</a> ()</td></tr>
72
73 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method causes the socket to close, and may also be triggered by other methods such as OnTimeout and OnError.  <a href="#Close_28_29"></a><br></td></tr>
74 <tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#_7EInspSocket_28_29">~InspSocket</a> ()</td></tr>
75
76 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The destructor may implicitly call <a class="el" href="classInspSocket.html#OnClose_28_29">OnClose()</a>, and will close() and shutdown() the file descriptor used for this socket.  <a href="#_7EInspSocket_28_29"></a><br></td></tr>
77 <tr><td colspan="2"><br><h2>Private Member Functions</h2></td></tr>
78 <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#FlushWriteBuffer_28_29">FlushWriteBuffer</a> ()</td></tr>
79
80 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Flushes the write buffer.  <a href="#FlushWriteBuffer_28_29"></a><br></td></tr>
81 <tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
82 <tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#fd">fd</a></td></tr>
83
84 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file descriptor of this socket.  <a href="#fd"></a><br></td></tr>
85 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceirc.html#string">std::string</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#host">host</a></td></tr>
86
87 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The hostname connected to.  <a href="#host"></a><br></td></tr>
88 <tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#port">port</a></td></tr>
89
90 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The port connected to, or the port this socket is listening on.  <a href="#port"></a><br></td></tr>
91 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="socket_8h.html#InspSocketState">InspSocketState</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#state">state</a></td></tr>
92
93 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The state for this socket, either listening, connecting, connected or error.  <a href="#state"></a><br></td></tr>
94 <tr><td class="memItemLeft" nowrap align="right" valign="top">sockaddr_in&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#addr">addr</a></td></tr>
95
96 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The host being connected to, in sockaddr form.  <a href="#addr"></a><br></td></tr>
97 <tr><td class="memItemLeft" nowrap align="right" valign="top">in_addr&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#addy">addy</a></td></tr>
98
99 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The host being connected to, in in_addr form.  <a href="#addy"></a><br></td></tr>
100 <tr><td class="memItemLeft" nowrap align="right" valign="top">time_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#timeout_5Fend">timeout_end</a></td></tr>
101
102 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">When this time is reached, the socket times out if it is in the CONNECTING state.  <a href="#timeout_5Fend"></a><br></td></tr>
103 <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#timeout">timeout</a></td></tr>
104
105 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This value is true if the socket has timed out.  <a href="#timeout"></a><br></td></tr>
106 <tr><td class="memItemLeft" nowrap align="right" valign="top">char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#ibuf_5B_36_35_35_33_35_5D">ibuf</a> [65535]</td></tr>
107
108 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Socket input buffer, used by read().  <a href="#ibuf_5B_36_35_35_33_35_5D"></a><br></td></tr>
109 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceirc.html#string">std::string</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#Buffer">Buffer</a></td></tr>
110
111 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The output buffer for this socket.  <a href="#Buffer"></a><br></td></tr>
112 <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceirc.html#string">std::string</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#IP">IP</a></td></tr>
113
114 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The IP address being connected to stored in string form for easy retrieval by accessors.  <a href="#IP"></a><br></td></tr>
115 <tr><td class="memItemLeft" nowrap align="right" valign="top">sockaddr_in&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#client">client</a></td></tr>
116
117 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Client sockaddr structure used by accept().  <a href="#client"></a><br></td></tr>
118 <tr><td class="memItemLeft" nowrap align="right" valign="top">sockaddr_in&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#server">server</a></td></tr>
119
120 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><a class="el" href="classServer.html">Server</a> sockaddr structure used by accept().  <a href="#server"></a><br></td></tr>
121 <tr><td class="memItemLeft" nowrap align="right" valign="top">socklen_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classInspSocket.html#length">length</a></td></tr>
122
123 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Used by accept() to indicate the sizes of the sockaddr_in structures.  <a href="#length"></a><br></td></tr>
124 </table>
125 <hr><a name="_details"></a><h2>Detailed Description</h2>
126 InspSocket is an extendable socket class which modules can use for TCP socket support. 
127 <p>
128 It is fully integrated into InspIRCds socket loop and attaches its sockets to the core's instance of the <a class="el" href="classSocketEngine.html">SocketEngine</a> class, meaning that any sockets you create have the same power and abilities as a socket created by the core itself. To use InspSocket, you must inherit a class from it, and use the InspSocket constructors to establish connections and bindings.
129 <p>
130
131 <p>
132 Definition at line <a class="el" href="socket_8h-source.html#l00047">47</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
133 <a class="anchor" name="InspSocket_28_29"></a><!-- doxytag: member="InspSocket::InspSocket" ref="InspSocket_28_29" args="()" --><p>
134 <table class="mdTable" cellpadding="2" cellspacing="0">
135   <tr>
136     <td class="mdRow">
137       <table cellpadding="0" cellspacing="0" border="0">
138         <tr>
139           <td class="md" nowrap valign="top">InspSocket::InspSocket           </td>
140           <td class="md" valign="top">(&nbsp;</td>
141           <td class="mdname1" valign="top" nowrap>          </td>
142           <td class="md" valign="top">&nbsp;)&nbsp;</td>
143           <td class="md" nowrap></td>
144         </tr>
145       </table>
146     </td>
147   </tr>
148 </table>
149 <table cellspacing="5" cellpadding="0" border="0">
150   <tr>
151     <td>
152       &nbsp;
153     </td>
154     <td>
155
156 <p>
157 The default constructor does nothing and should not be used. 
158 <p>
159
160 <p>
161 Definition at line <a class="el" href="socket_8cpp-source.html#l00045">45</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
162 <p>
163 References <a class="el" href="socket_8h.html#InspSocketStateI_5FDISCONNECTED">I_DISCONNECTED</a>, and <a class="el" href="socket_8h-source.html#l00072">state</a>.<div class="fragment"><pre class="fragment"><a name="l00046"></a>00046 {
164 <a name="l00047"></a>00047         this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FDISCONNECTED">I_DISCONNECTED</a>;
165 <a name="l00048"></a>00048 }
166 </pre></div>
167 <p>
168     </td>
169   </tr>
170 </table>
171 <a class="anchor" name="InspSocket_28int_20newfd_2C_20char_20_2Aip_29"></a><!-- doxytag: member="InspSocket::InspSocket" ref="InspSocket_28int_20newfd_2C_20char_20_2Aip_29" args="(int newfd, char *ip)" --><p>
172 <table class="mdTable" cellpadding="2" cellspacing="0">
173   <tr>
174     <td class="mdRow">
175       <table cellpadding="0" cellspacing="0" border="0">
176         <tr>
177           <td class="md" nowrap valign="top">InspSocket::InspSocket           </td>
178           <td class="md" valign="top">(&nbsp;</td>
179           <td class="md" nowrap valign="top">int&nbsp;</td>
180           <td class="mdname" nowrap> <em>newfd</em>, </td>
181         </tr>
182         <tr>
183           <td class="md" nowrap align="right"></td>
184           <td class="md"></td>
185           <td class="md" nowrap>char *&nbsp;</td>
186           <td class="mdname" nowrap> <em>ip</em></td>
187         </tr>
188         <tr>
189           <td class="md"></td>
190           <td class="md">)&nbsp;</td>
191           <td class="md" colspan="2"></td>
192         </tr>
193       </table>
194     </td>
195   </tr>
196 </table>
197 <table cellspacing="5" cellpadding="0" border="0">
198   <tr>
199     <td>
200       &nbsp;
201     </td>
202     <td>
203
204 <p>
205 This constructor is used to associate an existing connecting with an InspSocket class. 
206 <p>
207 The given file descriptor must be valid, and when initialized, the InspSocket will be set with the given IP address and placed in CONNECTED state.
208 <p>
209 Definition at line <a class="el" href="socket_8cpp-source.html#l00050">50</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
210 <p>
211 References <a class="el" href="socketengine_8cpp-source.html#l00065">SocketEngine::AddFd()</a>, <a class="el" href="socket_8h-source.html#l00054">fd</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FCONNECTED">I_CONNECTED</a>, <a class="el" href="socket_8h-source.html#l00118">IP</a>, <a class="el" href="inspircd_8h-source.html#l00111">InspIRCd::SE</a>, <a class="el" href="socket_8h-source.html#l00072">state</a>, and <a class="el" href="socketengine_8h-source.html#l00044">X_ESTAB_MODULE</a>.<div class="fragment"><pre class="fragment"><a name="l00051"></a>00051 {
212 <a name="l00052"></a>00052         this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a> = newfd;
213 <a name="l00053"></a>00053         this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTED">I_CONNECTED</a>;
214 <a name="l00054"></a>00054         this-&gt;<a class="code" href="classInspSocket.html#IP">IP</a> = ip;
215 <a name="l00055"></a>00055         <a class="code" href="modules_8cpp.html#ServerInstance">ServerInstance</a>-&gt;<a class="code" href="classInspIRCd.html#SE">SE</a>-&gt;<a class="code" href="classSocketEngine.html#AddFd_28int_20fd_2C_20bool_20readable_2C_20char_20type_29">AddFd</a>(this-&gt;fd,<span class="keyword">true</span>,<a class="code" href="socketengine_8h.html#X_5FESTAB_5FMODULE">X_ESTAB_MODULE</a>);
216 <a name="l00056"></a>00056         <a class="code" href="socket_8cpp.html#socket_5Fref_5B_36_35_35_33_35_5D">socket_ref</a>[this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a>] = <span class="keyword">this</span>;
217 <a name="l00057"></a>00057 }
218 </pre></div>
219 <p>
220     </td>
221   </tr>
222 </table>
223 <a class="anchor" name="InspSocket_28std_3A_3Astring_20host_2C_20int_20port_2C_20bool_20listening_2C_20unsigned_20long_20maxtime_29"></a><!-- doxytag: member="InspSocket::InspSocket" ref="InspSocket_28std_3A_3Astring_20host_2C_20int_20port_2C_20bool_20listening_2C_20unsigned_20long_20maxtime_29" args="(std::string host, int port, bool listening, unsigned long maxtime)" --><p>
224 <table class="mdTable" cellpadding="2" cellspacing="0">
225   <tr>
226     <td class="mdRow">
227       <table cellpadding="0" cellspacing="0" border="0">
228         <tr>
229           <td class="md" nowrap valign="top">InspSocket::InspSocket           </td>
230           <td class="md" valign="top">(&nbsp;</td>
231           <td class="md" nowrap valign="top"><a class="el" href="namespaceirc.html#string">std::string</a>&nbsp;</td>
232           <td class="mdname" nowrap> <em>host</em>, </td>
233         </tr>
234         <tr>
235           <td class="md" nowrap align="right"></td>
236           <td class="md"></td>
237           <td class="md" nowrap>int&nbsp;</td>
238           <td class="mdname" nowrap> <em>port</em>, </td>
239         </tr>
240         <tr>
241           <td class="md" nowrap align="right"></td>
242           <td class="md"></td>
243           <td class="md" nowrap>bool&nbsp;</td>
244           <td class="mdname" nowrap> <em>listening</em>, </td>
245         </tr>
246         <tr>
247           <td class="md" nowrap align="right"></td>
248           <td class="md"></td>
249           <td class="md" nowrap>unsigned long&nbsp;</td>
250           <td class="mdname" nowrap> <em>maxtime</em></td>
251         </tr>
252         <tr>
253           <td class="md"></td>
254           <td class="md">)&nbsp;</td>
255           <td class="md" colspan="2"></td>
256         </tr>
257       </table>
258     </td>
259   </tr>
260 </table>
261 <table cellspacing="5" cellpadding="0" border="0">
262   <tr>
263     <td>
264       &nbsp;
265     </td>
266     <td>
267
268 <p>
269 This constructor is used to create a new socket, either listening for connections, or an outbound connection to another host. 
270 <p>
271 <dl compact><dt><b>Parameters:</b></dt><dd>
272   <table border="0" cellspacing="2" cellpadding="0">
273     <tr><td valign="top"></td><td valign="top"><em>host</em>&nbsp;</td><td>The hostname to connect to, or bind to </td></tr>
274     <tr><td valign="top"></td><td valign="top"><em>port</em>&nbsp;</td><td>The port number to connect to, or bind to </td></tr>
275     <tr><td valign="top"></td><td valign="top"><em>listening</em>&nbsp;</td><td>true to listen on the given host:port pair, or false to connect to them </td></tr>
276     <tr><td valign="top"></td><td valign="top"><em>maxtime</em>&nbsp;</td><td>Number of seconds to wait, if connecting, before the connection times out and an <a class="el" href="classInspSocket.html#OnTimeout_28_29">OnTimeout()</a> event is generated</td></tr>
277   </table>
278 </dl>
279
280 <p>
281 Definition at line <a class="el" href="socket_8cpp-source.html#l00059">59</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
282 <p>
283 References <a class="el" href="socketengine_8cpp-source.html#l00065">SocketEngine::AddFd()</a>, <a class="el" href="socket_8h-source.html#l00078">addr</a>, <a class="el" href="socket_8h-source.html#l00084">addy</a>, <a class="el" href="inspircd__io_8h.html#BindSocket_28int_20sockfd_2C_20struct_20sockaddr_5Fin_20client_2C_20struct_20sockaddr_5Fin_20server_2C_20int_20port_2C_20char_20_2Aaddr_29">BindSocket()</a>, <a class="el" href="socket_8cpp-source.html#l00138">Close()</a>, <a class="el" href="inspircd__io_8h-source.html#l00029">DEBUG</a>, <a class="el" href="inspircd_8h-source.html#l00051">ERROR</a>, <a class="el" href="socket_8h-source.html#l00054">fd</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>, <a class="el" href="socket_8h.html#InspSocketErrorI_5FERR_5FBIND">I_ERR_BIND</a>, <a class="el" href="socket_8h.html#InspSocketErrorI_5FERR_5FCONNECT">I_ERR_CONNECT</a>, <a class="el" href="socket_8h.html#InspSocketErrorI_5FERR_5FSOCKET">I_ERR_SOCKET</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FLISTENING">I_LISTENING</a>, <a class="el" href="socket_8h-source.html#l00118">IP</a>, <a class="el" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log()</a>, <a class="el" href="socket_8cpp-source.html#l00264">OnError()</a>, <a class="el" href="inspircd__io_8h.html#OpenTCPSocket_28void_29">OpenTCPSocket()</a>, <a class="el" href="inspircd_8h-source.html#l00111">InspIRCd::SE</a>, <a class="el" href="socket_8h-source.html#l00072">state</a>, <a class="el" href="socket_8h-source.html#l00097">timeout</a>, <a class="el" href="socket_8h-source.html#l00091">timeout_end</a>, and <a class="el" href="socketengine_8h-source.html#l00044">X_ESTAB_MODULE</a>.<div class="fragment"><pre class="fragment"><a name="l00060"></a>00060 {
284 <a name="l00061"></a>00061         <span class="keywordflow">if</span> (listening) {
285 <a name="l00062"></a>00062                 <span class="keywordflow">if</span> ((this-&gt;fd = <a class="code" href="inspircd__io_8h.html#OpenTCPSocket_28void_29">OpenTCPSocket</a>()) == <a class="code" href="inspircd_8h.html#ERROR">ERROR</a>)
286 <a name="l00063"></a>00063                 {
287 <a name="l00064"></a>00064                         this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a> = -1;
288 <a name="l00065"></a>00065                         this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>;
289 <a name="l00066"></a>00066                         this-&gt;<a class="code" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a>(<a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FSOCKET">I_ERR_SOCKET</a>);
290 <a name="l00067"></a>00067                         <a class="code" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log</a>(<a class="code" href="inspircd__io_8h.html#DEBUG">DEBUG</a>,<span class="stringliteral">"OpenTCPSocket() error"</span>);
291 <a name="l00068"></a>00068                         <span class="keywordflow">return</span>;
292 <a name="l00069"></a>00069                 }
293 <a name="l00070"></a>00070                 <span class="keywordflow">else</span>
294 <a name="l00071"></a>00071                 {
295 <a name="l00072"></a>00072                         <span class="keywordflow">if</span> (<a class="code" href="inspircd__io_8h.html#BindSocket_28int_20sockfd_2C_20struct_20sockaddr_5Fin_20client_2C_20struct_20sockaddr_5Fin_20server_2C_20int_20port_2C_20char_20_2Aaddr_29">BindSocket</a>(this-&gt;fd,this-&gt;client,this-&gt;server,<a class="code" href="classInspSocket.html#port">port</a>,(<span class="keywordtype">char</span>*)<a class="code" href="classInspSocket.html#host">host</a>.c_str()) == <a class="code" href="inspircd_8h.html#ERROR">ERROR</a>)
296 <a name="l00073"></a>00073                         {
297 <a name="l00074"></a>00074                                 this-&gt;<a class="code" href="classInspSocket.html#Close_28_29">Close</a>();
298 <a name="l00075"></a>00075                                 this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a> = -1;
299 <a name="l00076"></a>00076                                 this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>;
300 <a name="l00077"></a>00077                                 this-&gt;<a class="code" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a>(<a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FBIND">I_ERR_BIND</a>);
301 <a name="l00078"></a>00078                                 <a class="code" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log</a>(<a class="code" href="inspircd__io_8h.html#DEBUG">DEBUG</a>,<span class="stringliteral">"BindSocket() error %s"</span>,strerror(errno));
302 <a name="l00079"></a>00079                                 <span class="keywordflow">return</span>;
303 <a name="l00080"></a>00080                         }
304 <a name="l00081"></a>00081                         <span class="keywordflow">else</span>
305 <a name="l00082"></a>00082                         {
306 <a name="l00083"></a>00083                                 this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FLISTENING">I_LISTENING</a>;
307 <a name="l00084"></a>00084                                 <a class="code" href="modules_8cpp.html#ServerInstance">ServerInstance</a>-&gt;<a class="code" href="classInspIRCd.html#SE">SE</a>-&gt;<a class="code" href="classSocketEngine.html#AddFd_28int_20fd_2C_20bool_20readable_2C_20char_20type_29">AddFd</a>(this-&gt;fd,<span class="keyword">true</span>,<a class="code" href="socketengine_8h.html#X_5FESTAB_5FMODULE">X_ESTAB_MODULE</a>);
308 <a name="l00085"></a>00085                                 <a class="code" href="socket_8cpp.html#socket_5Fref_5B_36_35_35_33_35_5D">socket_ref</a>[this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a>] = <span class="keyword">this</span>;
309 <a name="l00086"></a>00086                                 <a class="code" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log</a>(<a class="code" href="inspircd__io_8h.html#DEBUG">DEBUG</a>,<span class="stringliteral">"New socket now in I_LISTENING state"</span>);
310 <a name="l00087"></a>00087                                 <span class="keywordflow">return</span>;
311 <a name="l00088"></a>00088                         }
312 <a name="l00089"></a>00089                 }                       
313 <a name="l00090"></a>00090         } <span class="keywordflow">else</span> {
314 <a name="l00091"></a>00091                 <span class="keywordtype">char</span>* ip;
315 <a name="l00092"></a>00092                 this-&gt;<a class="code" href="classInspSocket.html#host">host</a> = <a class="code" href="classInspSocket.html#host">host</a>;
316 <a name="l00093"></a>00093                 hostent* hoste = gethostbyname(<a class="code" href="classInspSocket.html#host">host</a>.c_str());
317 <a name="l00094"></a>00094                 <span class="keywordflow">if</span> (!hoste) {
318 <a name="l00095"></a>00095                         ip = (<span class="keywordtype">char</span>*)<a class="code" href="classInspSocket.html#host">host</a>.c_str();
319 <a name="l00096"></a>00096                 } <span class="keywordflow">else</span> {
320 <a name="l00097"></a>00097                         <span class="keyword">struct </span>in_addr* ia = (in_addr*)hoste-&gt;h_addr;
321 <a name="l00098"></a>00098                         ip = inet_ntoa(*ia);
322 <a name="l00099"></a>00099                 }
323 <a name="l00100"></a>00100 
324 <a name="l00101"></a>00101                 this-&gt;<a class="code" href="classInspSocket.html#IP">IP</a> = ip;
325 <a name="l00102"></a>00102 
326 <a name="l00103"></a>00103                 <a class="code" href="classInspSocket.html#timeout_5Fend">timeout_end</a> = time(NULL)+maxtime;
327 <a name="l00104"></a>00104                 <a class="code" href="classInspSocket.html#timeout">timeout</a> = <span class="keyword">false</span>;
328 <a name="l00105"></a>00105                 <span class="keywordflow">if</span> ((this-&gt;fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
329 <a name="l00106"></a>00106                 {
330 <a name="l00107"></a>00107                         this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>;
331 <a name="l00108"></a>00108                         this-&gt;<a class="code" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a>(<a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FSOCKET">I_ERR_SOCKET</a>);
332 <a name="l00109"></a>00109                         <span class="keywordflow">return</span>;
333 <a name="l00110"></a>00110                 }
334 <a name="l00111"></a>00111                 this-&gt;<a class="code" href="classInspSocket.html#port">port</a> = <a class="code" href="classInspSocket.html#port">port</a>;
335 <a name="l00112"></a>00112                 inet_aton(ip,&amp;<a class="code" href="classInspSocket.html#addy">addy</a>);
336 <a name="l00113"></a>00113                 <a class="code" href="classInspSocket.html#addr">addr</a>.sin_family = AF_INET;
337 <a name="l00114"></a>00114                 <a class="code" href="classInspSocket.html#addr">addr</a>.sin_addr = <a class="code" href="classInspSocket.html#addy">addy</a>;
338 <a name="l00115"></a>00115                 <a class="code" href="classInspSocket.html#addr">addr</a>.sin_port = htons(this-&gt;port);
339 <a name="l00116"></a>00116 
340 <a name="l00117"></a>00117                 <span class="keywordtype">int</span> flags;
341 <a name="l00118"></a>00118                 flags = fcntl(this-&gt;fd, F_GETFL, 0);
342 <a name="l00119"></a>00119                 fcntl(this-&gt;fd, F_SETFL, flags | O_NONBLOCK);
343 <a name="l00120"></a>00120 
344 <a name="l00121"></a>00121                 <span class="keywordflow">if</span>(connect(this-&gt;fd, (sockaddr*)&amp;this-&gt;addr,<span class="keyword">sizeof</span>(this-&gt;addr)) == -1)
345 <a name="l00122"></a>00122                 {
346 <a name="l00123"></a>00123                         <span class="keywordflow">if</span> (errno != EINPROGRESS)
347 <a name="l00124"></a>00124                         {
348 <a name="l00125"></a>00125                                 this-&gt;<a class="code" href="classInspSocket.html#Close_28_29">Close</a>();
349 <a name="l00126"></a>00126                                 this-&gt;<a class="code" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a>(<a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FCONNECT">I_ERR_CONNECT</a>);
350 <a name="l00127"></a>00127                                 this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>;
351 <a name="l00128"></a>00128                                 <span class="keywordflow">return</span>;
352 <a name="l00129"></a>00129                         }
353 <a name="l00130"></a>00130                 }
354 <a name="l00131"></a>00131                 this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>;
355 <a name="l00132"></a>00132                 <a class="code" href="modules_8cpp.html#ServerInstance">ServerInstance</a>-&gt;<a class="code" href="classInspIRCd.html#SE">SE</a>-&gt;<a class="code" href="classSocketEngine.html#AddFd_28int_20fd_2C_20bool_20readable_2C_20char_20type_29">AddFd</a>(this-&gt;fd,<span class="keyword">false</span>,<a class="code" href="socketengine_8h.html#X_5FESTAB_5FMODULE">X_ESTAB_MODULE</a>);
356 <a name="l00133"></a>00133                 <a class="code" href="socket_8cpp.html#socket_5Fref_5B_36_35_35_33_35_5D">socket_ref</a>[this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a>] = <span class="keyword">this</span>;
357 <a name="l00134"></a>00134                 <span class="keywordflow">return</span>;
358 <a name="l00135"></a>00135         }
359 <a name="l00136"></a>00136 }
360 </pre></div>
361 <p>
362     </td>
363   </tr>
364 </table>
365 <a class="anchor" name="_7EInspSocket_28_29"></a><!-- doxytag: member="InspSocket::~InspSocket" ref="_7EInspSocket_28_29" args="()" --><p>
366 <table class="mdTable" cellpadding="2" cellspacing="0">
367   <tr>
368     <td class="mdRow">
369       <table cellpadding="0" cellspacing="0" border="0">
370         <tr>
371           <td class="md" nowrap valign="top">InspSocket::~InspSocket           </td>
372           <td class="md" valign="top">(&nbsp;</td>
373           <td class="mdname1" valign="top" nowrap>          </td>
374           <td class="md" valign="top">&nbsp;)&nbsp;</td>
375           <td class="md" nowrap><code> [virtual]</code></td>
376         </tr>
377       </table>
378     </td>
379   </tr>
380 </table>
381 <table cellspacing="5" cellpadding="0" border="0">
382   <tr>
383     <td>
384       &nbsp;
385     </td>
386     <td>
387
388 <p>
389 The destructor may implicitly call <a class="el" href="classInspSocket.html#OnClose_28_29">OnClose()</a>, and will close() and shutdown() the file descriptor used for this socket. 
390 <p>
391
392 <p>
393 Definition at line <a class="el" href="socket_8cpp-source.html#l00271">271</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
394 <p>
395 References <a class="el" href="socket_8cpp-source.html#l00138">Close()</a>.<div class="fragment"><pre class="fragment"><a name="l00272"></a>00272 {
396 <a name="l00273"></a>00273         this-&gt;<a class="code" href="classInspSocket.html#Close_28_29">Close</a>();
397 <a name="l00274"></a>00274 }
398 </pre></div>
399 <p>
400     </td>
401   </tr>
402 </table>
403 <hr><h2>Member Function Documentation</h2>
404 <a class="anchor" name="Close_28_29"></a><!-- doxytag: member="InspSocket::Close" ref="Close_28_29" args="()" --><p>
405 <table class="mdTable" cellpadding="2" cellspacing="0">
406   <tr>
407     <td class="mdRow">
408       <table cellpadding="0" cellspacing="0" border="0">
409         <tr>
410           <td class="md" nowrap valign="top">void InspSocket::Close           </td>
411           <td class="md" valign="top">(&nbsp;</td>
412           <td class="mdname1" valign="top" nowrap>          </td>
413           <td class="md" valign="top">&nbsp;)&nbsp;</td>
414           <td class="md" nowrap><code> [virtual]</code></td>
415         </tr>
416       </table>
417     </td>
418   </tr>
419 </table>
420 <table cellspacing="5" cellpadding="0" border="0">
421   <tr>
422     <td>
423       &nbsp;
424     </td>
425     <td>
426
427 <p>
428 This method causes the socket to close, and may also be triggered by other methods such as OnTimeout and OnError. 
429 <p>
430
431 <p>
432 Definition at line <a class="el" href="socket_8cpp-source.html#l00138">138</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
433 <p>
434 References <a class="el" href="socket_8h-source.html#l00054">fd</a>, and <a class="el" href="socket_8cpp-source.html#l00269">OnClose()</a>.
435 <p>
436 Referenced by <a class="el" href="socket_8cpp-source.html#l00059">InspSocket()</a>, and <a class="el" href="socket_8cpp-source.html#l00271">~InspSocket()</a>.<div class="fragment"><pre class="fragment"><a name="l00139"></a>00139 {
437 <a name="l00140"></a>00140         <span class="keywordflow">if</span> (this-&gt;fd != -1)
438 <a name="l00141"></a>00141         {
439 <a name="l00142"></a>00142                 this-&gt;<a class="code" href="classInspSocket.html#OnClose_28_29">OnClose</a>();
440 <a name="l00143"></a>00143                 shutdown(this-&gt;fd,2);
441 <a name="l00144"></a>00144                 close(this-&gt;fd);
442 <a name="l00145"></a>00145                 <a class="code" href="socket_8cpp.html#socket_5Fref_5B_36_35_35_33_35_5D">socket_ref</a>[this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a>] = NULL;
443 <a name="l00146"></a>00146                 this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a> = -1;
444 <a name="l00147"></a>00147         }
445 <a name="l00148"></a>00148 }
446 </pre></div>
447 <p>
448     </td>
449   </tr>
450 </table>
451 <a class="anchor" name="FlushWriteBuffer_28_29"></a><!-- doxytag: member="InspSocket::FlushWriteBuffer" ref="FlushWriteBuffer_28_29" args="()" --><p>
452 <table class="mdTable" cellpadding="2" cellspacing="0">
453   <tr>
454     <td class="mdRow">
455       <table cellpadding="0" cellspacing="0" border="0">
456         <tr>
457           <td class="md" nowrap valign="top">void InspSocket::FlushWriteBuffer           </td>
458           <td class="md" valign="top">(&nbsp;</td>
459           <td class="mdname1" valign="top" nowrap>          </td>
460           <td class="md" valign="top">&nbsp;)&nbsp;</td>
461           <td class="md" nowrap><code> [private]</code></td>
462         </tr>
463       </table>
464     </td>
465   </tr>
466 </table>
467 <table cellspacing="5" cellpadding="0" border="0">
468   <tr>
469     <td>
470       &nbsp;
471     </td>
472     <td>
473
474 <p>
475 Flushes the write buffer. 
476 <p>
477
478 <p>
479 Definition at line <a class="el" href="socket_8cpp-source.html#l00181">181</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
480 <p>
481 References <a class="el" href="socket_8h-source.html#l00111">Buffer</a>.
482 <p>
483 Referenced by <a class="el" href="socket_8cpp-source.html#l00197">Timeout()</a>, and <a class="el" href="socket_8cpp-source.html#l00174">Write()</a>.<div class="fragment"><pre class="fragment"><a name="l00182"></a>00182 {
484 <a name="l00183"></a>00183         <span class="keywordtype">int</span> result = 0;
485 <a name="l00184"></a>00184         <span class="keywordflow">if</span> (this-&gt;Buffer.length())
486 <a name="l00185"></a>00185         {
487 <a name="l00186"></a>00186                 result = send(this-&gt;fd,this-&gt;Buffer.c_str(),this-&gt;<a class="code" href="classInspSocket.html#Buffer">Buffer</a>.length(),0);
488 <a name="l00187"></a>00187                 <span class="keywordflow">if</span> (result &gt; 0)
489 <a name="l00188"></a>00188                 {
490 <a name="l00189"></a>00189                         <span class="comment">/* If we wrote some, advance the buffer forwards */</span>
491 <a name="l00190"></a>00190                         <span class="keywordtype">char</span>* n = (<span class="keywordtype">char</span>*)this-&gt;<a class="code" href="classInspSocket.html#Buffer">Buffer</a>.c_str();
492 <a name="l00191"></a>00191                         n += result;
493 <a name="l00192"></a>00192                         this-&gt;<a class="code" href="classInspSocket.html#Buffer">Buffer</a> = n;
494 <a name="l00193"></a>00193                 }
495 <a name="l00194"></a>00194         }
496 <a name="l00195"></a>00195 }
497 </pre></div>
498 <p>
499     </td>
500   </tr>
501 </table>
502 <a class="anchor" name="GetFd_28_29"></a><!-- doxytag: member="InspSocket::GetFd" ref="GetFd_28_29" args="()" --><p>
503 <table class="mdTable" cellpadding="2" cellspacing="0">
504   <tr>
505     <td class="mdRow">
506       <table cellpadding="0" cellspacing="0" border="0">
507         <tr>
508           <td class="md" nowrap valign="top">int InspSocket::GetFd           </td>
509           <td class="md" valign="top">(&nbsp;</td>
510           <td class="mdname1" valign="top" nowrap>          </td>
511           <td class="md" valign="top">&nbsp;)&nbsp;</td>
512           <td class="md" nowrap></td>
513         </tr>
514       </table>
515     </td>
516   </tr>
517 </table>
518 <table cellspacing="5" cellpadding="0" border="0">
519   <tr>
520     <td>
521       &nbsp;
522     </td>
523     <td>
524
525 <p>
526 This method returns the socket's file descriptor as assigned by the operating system, or -1 if no descriptor has been assigned. 
527 <p>
528
529 <p>
530 Definition at line <a class="el" href="socket_8cpp-source.html#l00258">258</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
531 <p>
532 References <a class="el" href="socket_8h-source.html#l00054">fd</a>.<div class="fragment"><pre class="fragment"><a name="l00259"></a>00259 {
533 <a name="l00260"></a>00260         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classInspSocket.html#fd">fd</a>;
534 <a name="l00261"></a>00261 }
535 </pre></div>
536 <p>
537     </td>
538   </tr>
539 </table>
540 <a class="anchor" name="GetIP_28_29"></a><!-- doxytag: member="InspSocket::GetIP" ref="GetIP_28_29" args="()" --><p>
541 <table class="mdTable" cellpadding="2" cellspacing="0">
542   <tr>
543     <td class="mdRow">
544       <table cellpadding="0" cellspacing="0" border="0">
545         <tr>
546           <td class="md" nowrap valign="top"><a class="el" href="namespaceirc.html#string">std::string</a> InspSocket::GetIP           </td>
547           <td class="md" valign="top">(&nbsp;</td>
548           <td class="mdname1" valign="top" nowrap>          </td>
549           <td class="md" valign="top">&nbsp;)&nbsp;</td>
550           <td class="md" nowrap></td>
551         </tr>
552       </table>
553     </td>
554   </tr>
555 </table>
556 <table cellspacing="5" cellpadding="0" border="0">
557   <tr>
558     <td>
559       &nbsp;
560     </td>
561     <td>
562
563 <p>
564 Returns the IP address associated with this connection, or an empty string if no IP address exists. 
565 <p>
566
567 <p>
568 Definition at line <a class="el" href="socket_8cpp-source.html#l00150">150</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
569 <p>
570 References <a class="el" href="socket_8h-source.html#l00118">IP</a>.<div class="fragment"><pre class="fragment"><a name="l00151"></a>00151 {
571 <a name="l00152"></a>00152         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classInspSocket.html#IP">IP</a>;
572 <a name="l00153"></a>00153 }
573 </pre></div>
574 <p>
575     </td>
576   </tr>
577 </table>
578 <a class="anchor" name="GetState_28_29"></a><!-- doxytag: member="InspSocket::GetState" ref="GetState_28_29" args="()" --><p>
579 <table class="mdTable" cellpadding="2" cellspacing="0">
580   <tr>
581     <td class="mdRow">
582       <table cellpadding="0" cellspacing="0" border="0">
583         <tr>
584           <td class="md" nowrap valign="top"><a class="el" href="socket_8h.html#InspSocketState">InspSocketState</a> InspSocket::GetState           </td>
585           <td class="md" valign="top">(&nbsp;</td>
586           <td class="mdname1" valign="top" nowrap>          </td>
587           <td class="md" valign="top">&nbsp;)&nbsp;</td>
588           <td class="md" nowrap></td>
589         </tr>
590       </table>
591     </td>
592   </tr>
593 </table>
594 <table cellspacing="5" cellpadding="0" border="0">
595   <tr>
596     <td>
597       &nbsp;
598     </td>
599     <td>
600
601 <p>
602 Returns the current socket state. 
603 <p>
604
605 <p>
606 Definition at line <a class="el" href="socket_8cpp-source.html#l00253">253</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
607 <p>
608 References <a class="el" href="socket_8h-source.html#l00072">state</a>.<div class="fragment"><pre class="fragment"><a name="l00254"></a>00254 {
609 <a name="l00255"></a>00255         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classInspSocket.html#state">state</a>;
610 <a name="l00256"></a>00256 }
611 </pre></div>
612 <p>
613     </td>
614   </tr>
615 </table>
616 <a class="anchor" name="OnClose_28_29"></a><!-- doxytag: member="InspSocket::OnClose" ref="OnClose_28_29" args="()" --><p>
617 <table class="mdTable" cellpadding="2" cellspacing="0">
618   <tr>
619     <td class="mdRow">
620       <table cellpadding="0" cellspacing="0" border="0">
621         <tr>
622           <td class="md" nowrap valign="top">void InspSocket::OnClose           </td>
623           <td class="md" valign="top">(&nbsp;</td>
624           <td class="mdname1" valign="top" nowrap>          </td>
625           <td class="md" valign="top">&nbsp;)&nbsp;</td>
626           <td class="md" nowrap><code> [virtual]</code></td>
627         </tr>
628       </table>
629     </td>
630   </tr>
631 </table>
632 <table cellspacing="5" cellpadding="0" border="0">
633   <tr>
634     <td>
635       &nbsp;
636     </td>
637     <td>
638
639 <p>
640 Whenever close() is called, <a class="el" href="classInspSocket.html#OnClose_28_29">OnClose()</a> will be called first. 
641 <p>
642 Please note that this means OnClose will be called alongside <a class="el" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError()</a>, <a class="el" href="classInspSocket.html#OnTimeout_28_29">OnTimeout()</a>, and <a class="el" href="classInspSocket.html#Close_28_29">Close()</a>, and also when cancelling a listening socket by calling the destructor indirectly.
643 <p>
644 Definition at line <a class="el" href="socket_8cpp-source.html#l00269">269</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
645 <p>
646 Referenced by <a class="el" href="socket_8cpp-source.html#l00138">Close()</a>.<div class="fragment"><pre class="fragment"><a name="l00269"></a>00269 { <span class="keywordflow">return</span>; }
647 </pre></div>
648 <p>
649     </td>
650   </tr>
651 </table>
652 <a class="anchor" name="OnConnected_28_29"></a><!-- doxytag: member="InspSocket::OnConnected" ref="OnConnected_28_29" args="()" --><p>
653 <table class="mdTable" cellpadding="2" cellspacing="0">
654   <tr>
655     <td class="mdRow">
656       <table cellpadding="0" cellspacing="0" border="0">
657         <tr>
658           <td class="md" nowrap valign="top">bool InspSocket::OnConnected           </td>
659           <td class="md" valign="top">(&nbsp;</td>
660           <td class="mdname1" valign="top" nowrap>          </td>
661           <td class="md" valign="top">&nbsp;)&nbsp;</td>
662           <td class="md" nowrap><code> [virtual]</code></td>
663         </tr>
664       </table>
665     </td>
666   </tr>
667 </table>
668 <table cellspacing="5" cellpadding="0" border="0">
669   <tr>
670     <td>
671       &nbsp;
672     </td>
673     <td>
674
675 <p>
676 This method is called when an outbound connection on your socket is completed. 
677 <p>
678 <dl compact><dt><b>Returns:</b></dt><dd>false to abort the connection, true to continue</dd></dl>
679
680 <p>
681 Definition at line <a class="el" href="socket_8cpp-source.html#l00263">263</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
682 <p>
683 Referenced by <a class="el" href="socket_8cpp-source.html#l00216">Poll()</a>.<div class="fragment"><pre class="fragment"><a name="l00263"></a>00263 { <span class="keywordflow">return</span> <span class="keyword">true</span>; }
684 </pre></div>
685 <p>
686     </td>
687   </tr>
688 </table>
689 <a class="anchor" name="OnDataReady_28_29"></a><!-- doxytag: member="InspSocket::OnDataReady" ref="OnDataReady_28_29" args="()" --><p>
690 <table class="mdTable" cellpadding="2" cellspacing="0">
691   <tr>
692     <td class="mdRow">
693       <table cellpadding="0" cellspacing="0" border="0">
694         <tr>
695           <td class="md" nowrap valign="top">bool InspSocket::OnDataReady           </td>
696           <td class="md" valign="top">(&nbsp;</td>
697           <td class="mdname1" valign="top" nowrap>          </td>
698           <td class="md" valign="top">&nbsp;)&nbsp;</td>
699           <td class="md" nowrap><code> [virtual]</code></td>
700         </tr>
701       </table>
702     </td>
703   </tr>
704 </table>
705 <table cellspacing="5" cellpadding="0" border="0">
706   <tr>
707     <td>
708       &nbsp;
709     </td>
710     <td>
711
712 <p>
713 When there is data waiting to be read on a socket, the <a class="el" href="classInspSocket.html#OnDataReady_28_29">OnDataReady()</a> method is called. 
714 <p>
715 Within this method, you *MUST* call the <a class="el" href="classInspSocket.html#Read_28_29">Read()</a> method to read any pending data. At its lowest level, this event is signalled by the core via the socket engine. If you return false from this function, the core removes your socket from its list and erases it from the socket engine, then calls <a class="el" href="classInspSocket.html#Close_28_29">InspSocket::Close()</a> and deletes it. <dl compact><dt><b>Returns:</b></dt><dd>false to close the socket</dd></dl>
716
717 <p>
718 Definition at line <a class="el" href="socket_8cpp-source.html#l00267">267</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
719 <p>
720 Referenced by <a class="el" href="socket_8cpp-source.html#l00216">Poll()</a>.<div class="fragment"><pre class="fragment"><a name="l00267"></a>00267 { <span class="keywordflow">return</span> <span class="keyword">true</span>; }
721 </pre></div>
722 <p>
723     </td>
724   </tr>
725 </table>
726 <a class="anchor" name="OnDisconnect_28_29"></a><!-- doxytag: member="InspSocket::OnDisconnect" ref="OnDisconnect_28_29" args="()" --><p>
727 <table class="mdTable" cellpadding="2" cellspacing="0">
728   <tr>
729     <td class="mdRow">
730       <table cellpadding="0" cellspacing="0" border="0">
731         <tr>
732           <td class="md" nowrap valign="top">int InspSocket::OnDisconnect           </td>
733           <td class="md" valign="top">(&nbsp;</td>
734           <td class="mdname1" valign="top" nowrap>          </td>
735           <td class="md" valign="top">&nbsp;)&nbsp;</td>
736           <td class="md" nowrap><code> [virtual]</code></td>
737         </tr>
738       </table>
739     </td>
740   </tr>
741 </table>
742 <table cellspacing="5" cellpadding="0" border="0">
743   <tr>
744     <td>
745       &nbsp;
746     </td>
747     <td>
748
749 <p>
750 When an established connection is terminated, the OnDisconnect method is triggered. 
751 <p>
752
753 <p>
754 Definition at line <a class="el" href="socket_8cpp-source.html#l00265">265</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.<div class="fragment"><pre class="fragment"><a name="l00265"></a>00265 { <span class="keywordflow">return</span> 0; }
755 </pre></div>
756 <p>
757     </td>
758   </tr>
759 </table>
760 <a class="anchor" name="OnError_28InspSocketError_20e_29"></a><!-- doxytag: member="InspSocket::OnError" ref="OnError_28InspSocketError_20e_29" args="(InspSocketError e)" --><p>
761 <table class="mdTable" cellpadding="2" cellspacing="0">
762   <tr>
763     <td class="mdRow">
764       <table cellpadding="0" cellspacing="0" border="0">
765         <tr>
766           <td class="md" nowrap valign="top">void InspSocket::OnError           </td>
767           <td class="md" valign="top">(&nbsp;</td>
768           <td class="md" nowrap valign="top"><a class="el" href="socket_8h.html#InspSocketError">InspSocketError</a>&nbsp;</td>
769           <td class="mdname1" valign="top" nowrap> <em>e</em>          </td>
770           <td class="md" valign="top">&nbsp;)&nbsp;</td>
771           <td class="md" nowrap><code> [virtual]</code></td>
772         </tr>
773       </table>
774     </td>
775   </tr>
776 </table>
777 <table cellspacing="5" cellpadding="0" border="0">
778   <tr>
779     <td>
780       &nbsp;
781     </td>
782     <td>
783
784 <p>
785 This method is called when an error occurs. 
786 <p>
787 A closed socket in itself is not an error, however errors also generate close events. <dl compact><dt><b>Parameters:</b></dt><dd>
788   <table border="0" cellspacing="2" cellpadding="0">
789     <tr><td valign="top"></td><td valign="top"><em>e</em>&nbsp;</td><td>The error type which occured</td></tr>
790   </table>
791 </dl>
792
793 <p>
794 Definition at line <a class="el" href="socket_8cpp-source.html#l00264">264</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
795 <p>
796 Referenced by <a class="el" href="socket_8cpp-source.html#l00059">InspSocket()</a>, and <a class="el" href="socket_8cpp-source.html#l00197">Timeout()</a>.<div class="fragment"><pre class="fragment"><a name="l00264"></a>00264 { <span class="keywordflow">return</span>; }
797 </pre></div>
798 <p>
799     </td>
800   </tr>
801 </table>
802 <a class="anchor" name="OnIncomingConnection_28int_20newfd_2C_20char_20_2Aip_29"></a><!-- doxytag: member="InspSocket::OnIncomingConnection" ref="OnIncomingConnection_28int_20newfd_2C_20char_20_2Aip_29" args="(int newfd, char *ip)" --><p>
803 <table class="mdTable" cellpadding="2" cellspacing="0">
804   <tr>
805     <td class="mdRow">
806       <table cellpadding="0" cellspacing="0" border="0">
807         <tr>
808           <td class="md" nowrap valign="top">int InspSocket::OnIncomingConnection           </td>
809           <td class="md" valign="top">(&nbsp;</td>
810           <td class="md" nowrap valign="top">int&nbsp;</td>
811           <td class="mdname" nowrap> <em>newfd</em>, </td>
812         </tr>
813         <tr>
814           <td class="md" nowrap align="right"></td>
815           <td class="md"></td>
816           <td class="md" nowrap>char *&nbsp;</td>
817           <td class="mdname" nowrap> <em>ip</em></td>
818         </tr>
819         <tr>
820           <td class="md"></td>
821           <td class="md">)&nbsp;</td>
822           <td class="md" colspan="2"><code> [virtual]</code></td>
823         </tr>
824       </table>
825     </td>
826   </tr>
827 </table>
828 <table cellspacing="5" cellpadding="0" border="0">
829   <tr>
830     <td>
831       &nbsp;
832     </td>
833     <td>
834
835 <p>
836 If your socket is a listening socket, when a new connection comes in on the socket this method will be called. 
837 <p>
838 Given the new file descriptor in the parameters, and the IP, it is recommended you copy them to a new instance of your socket class, e.g.:<p>
839 MySocket* newsocket = new MySocket(newfd,ip);<p>
840 Once you have done this, you can then associate the new socket with the core using <a class="el" href="classServer.html#AddSocket_28InspSocket_20_2Asock_29">Server::AddSocket()</a>.
841 <p>
842 Definition at line <a class="el" href="socket_8cpp-source.html#l00266">266</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
843 <p>
844 Referenced by <a class="el" href="socket_8cpp-source.html#l00216">Poll()</a>.<div class="fragment"><pre class="fragment"><a name="l00266"></a>00266 { <span class="keywordflow">return</span> 0; }
845 </pre></div>
846 <p>
847     </td>
848   </tr>
849 </table>
850 <a class="anchor" name="OnTimeout_28_29"></a><!-- doxytag: member="InspSocket::OnTimeout" ref="OnTimeout_28_29" args="()" --><p>
851 <table class="mdTable" cellpadding="2" cellspacing="0">
852   <tr>
853     <td class="mdRow">
854       <table cellpadding="0" cellspacing="0" border="0">
855         <tr>
856           <td class="md" nowrap valign="top">void InspSocket::OnTimeout           </td>
857           <td class="md" valign="top">(&nbsp;</td>
858           <td class="mdname1" valign="top" nowrap>          </td>
859           <td class="md" valign="top">&nbsp;)&nbsp;</td>
860           <td class="md" nowrap><code> [virtual]</code></td>
861         </tr>
862       </table>
863     </td>
864   </tr>
865 </table>
866 <table cellspacing="5" cellpadding="0" border="0">
867   <tr>
868     <td>
869       &nbsp;
870     </td>
871     <td>
872
873 <p>
874 When an outbound connection fails, and the attempt times out, you will receive this event. 
875 <p>
876 The mthod will trigger once maxtime secons are reached (as given in the constructor) just before the socket's descriptor is closed.
877 <p>
878 Definition at line <a class="el" href="socket_8cpp-source.html#l00268">268</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
879 <p>
880 Referenced by <a class="el" href="socket_8cpp-source.html#l00197">Timeout()</a>.<div class="fragment"><pre class="fragment"><a name="l00268"></a>00268 { <span class="keywordflow">return</span>; }
881 </pre></div>
882 <p>
883     </td>
884   </tr>
885 </table>
886 <a class="anchor" name="Poll_28_29"></a><!-- doxytag: member="InspSocket::Poll" ref="Poll_28_29" args="()" --><p>
887 <table class="mdTable" cellpadding="2" cellspacing="0">
888   <tr>
889     <td class="mdRow">
890       <table cellpadding="0" cellspacing="0" border="0">
891         <tr>
892           <td class="md" nowrap valign="top">bool InspSocket::Poll           </td>
893           <td class="md" valign="top">(&nbsp;</td>
894           <td class="mdname1" valign="top" nowrap>          </td>
895           <td class="md" valign="top">&nbsp;)&nbsp;</td>
896           <td class="md" nowrap></td>
897         </tr>
898       </table>
899     </td>
900   </tr>
901 </table>
902 <table cellspacing="5" cellpadding="0" border="0">
903   <tr>
904     <td>
905       &nbsp;
906     </td>
907     <td>
908
909 <p>
910 Only the core should call this function. 
911 <p>
912 When called, it is assumed the socket is ready to read data, and the method call routes the event to the various methods of InspSocket for you to handle. This can also cause the socket's state to change.
913 <p>
914 Definition at line <a class="el" href="socket_8cpp-source.html#l00216">216</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
915 <p>
916 References <a class="el" href="socketengine_8cpp-source.html#l00065">SocketEngine::AddFd()</a>, <a class="el" href="socket_8h-source.html#l00124">client</a>, <a class="el" href="socketengine_8cpp-source.html#l00103">SocketEngine::DelFd()</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FCONNECTED">I_CONNECTED</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FLISTENING">I_LISTENING</a>, <a class="el" href="socket_8h-source.html#l00136">length</a>, <a class="el" href="socket_8cpp-source.html#l00263">OnConnected()</a>, <a class="el" href="socket_8cpp-source.html#l00267">OnDataReady()</a>, <a class="el" href="socket_8cpp-source.html#l00266">OnIncomingConnection()</a>, <a class="el" href="inspircd_8h-source.html#l00111">InspIRCd::SE</a>, <a class="el" href="socket_8cpp-source.html#l00247">SetState()</a>, and <a class="el" href="socketengine_8h-source.html#l00044">X_ESTAB_MODULE</a>.<div class="fragment"><pre class="fragment"><a name="l00217"></a>00217 {
917 <a name="l00218"></a>00218         <span class="keywordtype">int</span> incoming = -1;
918 <a name="l00219"></a>00219         
919 <a name="l00220"></a>00220         <span class="keywordflow">switch</span> (this-&gt;state)
920 <a name="l00221"></a>00221         {
921 <a name="l00222"></a>00222                 <span class="keywordflow">case</span> <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>:
922 <a name="l00223"></a>00223                         this-&gt;<a class="code" href="classInspSocket.html#SetState_28InspSocketState_20s_29">SetState</a>(<a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTED">I_CONNECTED</a>);
923 <a name="l00224"></a>00224                         <span class="comment">/* Our socket was in write-state, so delete it and re-add it</span>
924 <a name="l00225"></a>00225 <span class="comment">                         * in read-state.</span>
925 <a name="l00226"></a>00226 <span class="comment">                         */</span>
926 <a name="l00227"></a>00227                         <a class="code" href="modules_8cpp.html#ServerInstance">ServerInstance</a>-&gt;<a class="code" href="classInspIRCd.html#SE">SE</a>-&gt;<a class="code" href="classSocketEngine.html#DelFd_28int_20fd_29">DelFd</a>(this-&gt;fd);
927 <a name="l00228"></a>00228                         <a class="code" href="modules_8cpp.html#ServerInstance">ServerInstance</a>-&gt;<a class="code" href="classInspIRCd.html#SE">SE</a>-&gt;<a class="code" href="classSocketEngine.html#AddFd_28int_20fd_2C_20bool_20readable_2C_20char_20type_29">AddFd</a>(this-&gt;fd,<span class="keyword">true</span>,<a class="code" href="socketengine_8h.html#X_5FESTAB_5FMODULE">X_ESTAB_MODULE</a>);
928 <a name="l00229"></a>00229                         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classInspSocket.html#OnConnected_28_29">OnConnected</a>();
929 <a name="l00230"></a>00230                 <span class="keywordflow">break</span>;
930 <a name="l00231"></a>00231                 <span class="keywordflow">case</span> <a class="code" href="socket_8h.html#InspSocketStateI_5FLISTENING">I_LISTENING</a>:
931 <a name="l00232"></a>00232                         <a class="code" href="classInspSocket.html#length">length</a> = <span class="keyword">sizeof</span> (<a class="code" href="classInspSocket.html#client">client</a>);
932 <a name="l00233"></a>00233                         incoming = accept (this-&gt;fd, (sockaddr*)&amp;<a class="code" href="classInspSocket.html#client">client</a>,&amp;<a class="code" href="classInspSocket.html#length">length</a>);
933 <a name="l00234"></a>00234                         this-&gt;<a class="code" href="classInspSocket.html#OnIncomingConnection_28int_20newfd_2C_20char_20_2Aip_29">OnIncomingConnection</a>(incoming,inet_ntoa(<a class="code" href="classInspSocket.html#client">client</a>.sin_addr));
934 <a name="l00235"></a>00235                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
935 <a name="l00236"></a>00236                 <span class="keywordflow">break</span>;
936 <a name="l00237"></a>00237                 <span class="keywordflow">case</span> <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTED">I_CONNECTED</a>:
937 <a name="l00238"></a>00238                         <span class="keywordflow">return</span> this-&gt;<a class="code" href="classInspSocket.html#OnDataReady_28_29">OnDataReady</a>();
938 <a name="l00239"></a>00239                 <span class="keywordflow">break</span>;
939 <a name="l00240"></a>00240                 <span class="keywordflow">default</span>:
940 <a name="l00241"></a>00241                 <span class="keywordflow">break</span>;
941 <a name="l00242"></a>00242         }
942 <a name="l00243"></a>00243 
943 <a name="l00244"></a>00244         <span class="keywordflow">return</span> <span class="keyword">true</span>;
944 <a name="l00245"></a>00245 }
945 </pre></div>
946 <p>
947     </td>
948   </tr>
949 </table>
950 <a class="anchor" name="Read_28_29"></a><!-- doxytag: member="InspSocket::Read" ref="Read_28_29" args="()" --><p>
951 <table class="mdTable" cellpadding="2" cellspacing="0">
952   <tr>
953     <td class="mdRow">
954       <table cellpadding="0" cellspacing="0" border="0">
955         <tr>
956           <td class="md" nowrap valign="top">char * InspSocket::Read           </td>
957           <td class="md" valign="top">(&nbsp;</td>
958           <td class="mdname1" valign="top" nowrap>          </td>
959           <td class="md" valign="top">&nbsp;)&nbsp;</td>
960           <td class="md" nowrap><code> [virtual]</code></td>
961         </tr>
962       </table>
963     </td>
964   </tr>
965 </table>
966 <table cellspacing="5" cellpadding="0" border="0">
967   <tr>
968     <td>
969       &nbsp;
970     </td>
971     <td>
972
973 <p>
974 Reads all pending bytes from the socket into a char* array which can be up to 16 kilobytes in length. 
975 <p>
976
977 <p>
978 Definition at line <a class="el" href="socket_8cpp-source.html#l00155">155</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
979 <p>
980 References <a class="el" href="inspircd__io_8h-source.html#l00029">DEBUG</a>, <a class="el" href="socket_8h-source.html#l00106">ibuf</a>, and <a class="el" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log()</a>.<div class="fragment"><pre class="fragment"><a name="l00156"></a>00156 {
981 <a name="l00157"></a>00157         <span class="keywordtype">int</span> n = recv(this-&gt;fd,this-&gt;ibuf,<span class="keyword">sizeof</span>(this-&gt;ibuf),0);
982 <a name="l00158"></a>00158         <span class="keywordflow">if</span> (n &gt; 0)
983 <a name="l00159"></a>00159         {
984 <a name="l00160"></a>00160                 <a class="code" href="classInspSocket.html#ibuf_5B_36_35_35_33_35_5D">ibuf</a>[n] = 0;
985 <a name="l00161"></a>00161                 <span class="keywordflow">return</span> <a class="code" href="classInspSocket.html#ibuf_5B_36_35_35_33_35_5D">ibuf</a>;
986 <a name="l00162"></a>00162         }
987 <a name="l00163"></a>00163         <span class="keywordflow">else</span>
988 <a name="l00164"></a>00164         {
989 <a name="l00165"></a>00165                 <a class="code" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log</a>(<a class="code" href="inspircd__io_8h.html#DEBUG">DEBUG</a>,<span class="stringliteral">"EOF or error on socket"</span>);
990 <a name="l00166"></a>00166                 <span class="keywordflow">return</span> NULL;
991 <a name="l00167"></a>00167         }
992 <a name="l00168"></a>00168 }
993 </pre></div>
994 <p>
995     </td>
996   </tr>
997 </table>
998 <a class="anchor" name="SetState_28InspSocketState_20s_29"></a><!-- doxytag: member="InspSocket::SetState" ref="SetState_28InspSocketState_20s_29" args="(InspSocketState s)" --><p>
999 <table class="mdTable" cellpadding="2" cellspacing="0">
1000   <tr>
1001     <td class="mdRow">
1002       <table cellpadding="0" cellspacing="0" border="0">
1003         <tr>
1004           <td class="md" nowrap valign="top">void InspSocket::SetState           </td>
1005           <td class="md" valign="top">(&nbsp;</td>
1006           <td class="md" nowrap valign="top"><a class="el" href="socket_8h.html#InspSocketState">InspSocketState</a>&nbsp;</td>
1007           <td class="mdname1" valign="top" nowrap> <em>s</em>          </td>
1008           <td class="md" valign="top">&nbsp;)&nbsp;</td>
1009           <td class="md" nowrap></td>
1010         </tr>
1011       </table>
1012     </td>
1013   </tr>
1014 </table>
1015 <table cellspacing="5" cellpadding="0" border="0">
1016   <tr>
1017     <td>
1018       &nbsp;
1019     </td>
1020     <td>
1021
1022 <p>
1023 Changes the socket's state. 
1024 <p>
1025 The core uses this to change socket states, and you should not call it directly.
1026 <p>
1027 Definition at line <a class="el" href="socket_8cpp-source.html#l00247">247</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
1028 <p>
1029 References <a class="el" href="inspircd__io_8h-source.html#l00029">DEBUG</a>, <a class="el" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log()</a>, and <a class="el" href="socket_8h-source.html#l00072">state</a>.
1030 <p>
1031 Referenced by <a class="el" href="socket_8cpp-source.html#l00216">Poll()</a>.<div class="fragment"><pre class="fragment"><a name="l00248"></a>00248 {
1032 <a name="l00249"></a>00249         <a class="code" href="globals_8h.html#log_28int_20level_2C_20char_20_2Atext_2C_2E_2E_2E_29">log</a>(<a class="code" href="inspircd__io_8h.html#DEBUG">DEBUG</a>,<span class="stringliteral">"Socket state change"</span>);
1033 <a name="l00250"></a>00250         this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = s;
1034 <a name="l00251"></a>00251 }
1035 </pre></div>
1036 <p>
1037     </td>
1038   </tr>
1039 </table>
1040 <a class="anchor" name="Timeout_28time_5Ft_20current_29"></a><!-- doxytag: member="InspSocket::Timeout" ref="Timeout_28time_5Ft_20current_29" args="(time_t current)" --><p>
1041 <table class="mdTable" cellpadding="2" cellspacing="0">
1042   <tr>
1043     <td class="mdRow">
1044       <table cellpadding="0" cellspacing="0" border="0">
1045         <tr>
1046           <td class="md" nowrap valign="top">bool InspSocket::Timeout           </td>
1047           <td class="md" valign="top">(&nbsp;</td>
1048           <td class="md" nowrap valign="top">time_t&nbsp;</td>
1049           <td class="mdname1" valign="top" nowrap> <em>current</em>          </td>
1050           <td class="md" valign="top">&nbsp;)&nbsp;</td>
1051           <td class="md" nowrap></td>
1052         </tr>
1053       </table>
1054     </td>
1055   </tr>
1056 </table>
1057 <table cellspacing="5" cellpadding="0" border="0">
1058   <tr>
1059     <td>
1060       &nbsp;
1061     </td>
1062     <td>
1063
1064 <p>
1065 This function checks if the socket has timed out yet, given the current time in the parameter. 
1066 <p>
1067 <dl compact><dt><b>Returns:</b></dt><dd>true if timed out, false if not timed out</dd></dl>
1068
1069 <p>
1070 Definition at line <a class="el" href="socket_8cpp-source.html#l00197">197</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
1071 <p>
1072 References <a class="el" href="socket_8cpp-source.html#l00181">FlushWriteBuffer()</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>, <a class="el" href="socket_8h.html#InspSocketErrorI_5FERR_5FTIMEOUT">I_ERR_TIMEOUT</a>, <a class="el" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>, <a class="el" href="socket_8cpp-source.html#l00264">OnError()</a>, <a class="el" href="socket_8cpp-source.html#l00268">OnTimeout()</a>, <a class="el" href="socket_8h-source.html#l00072">state</a>, <a class="el" href="socket_8h-source.html#l00097">timeout</a>, and <a class="el" href="socket_8h-source.html#l00091">timeout_end</a>.<div class="fragment"><pre class="fragment"><a name="l00198"></a>00198 {
1073 <a name="l00199"></a>00199         <span class="keywordflow">if</span> ((this-&gt;state == <a class="code" href="socket_8h.html#InspSocketStateI_5FCONNECTING">I_CONNECTING</a>) &amp;&amp; (current &gt; <a class="code" href="classInspSocket.html#timeout_5Fend">timeout_end</a>))
1074 <a name="l00200"></a>00200         {
1075 <a name="l00201"></a>00201                 <span class="comment">// for non-listening sockets, the timeout can occur</span>
1076 <a name="l00202"></a>00202                 <span class="comment">// which causes termination of the connection after</span>
1077 <a name="l00203"></a>00203                 <span class="comment">// the given number of seconds without a successful</span>
1078 <a name="l00204"></a>00204                 <span class="comment">// connection.</span>
1079 <a name="l00205"></a>00205                 this-&gt;<a class="code" href="classInspSocket.html#OnTimeout_28_29">OnTimeout</a>();
1080 <a name="l00206"></a>00206                 this-&gt;<a class="code" href="classInspSocket.html#OnError_28InspSocketError_20e_29">OnError</a>(<a class="code" href="socket_8h.html#InspSocketErrorI_5FERR_5FTIMEOUT">I_ERR_TIMEOUT</a>);
1081 <a name="l00207"></a>00207                 <a class="code" href="classInspSocket.html#timeout">timeout</a> = <span class="keyword">true</span>;
1082 <a name="l00208"></a>00208                 this-&gt;<a class="code" href="classInspSocket.html#state">state</a> = <a class="code" href="socket_8h.html#InspSocketStateI_5FERROR">I_ERROR</a>;
1083 <a name="l00209"></a>00209                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
1084 <a name="l00210"></a>00210         }
1085 <a name="l00211"></a>00211         <span class="keywordflow">if</span> (this-&gt;Buffer.length())
1086 <a name="l00212"></a>00212                 this-&gt;<a class="code" href="classInspSocket.html#FlushWriteBuffer_28_29">FlushWriteBuffer</a>();
1087 <a name="l00213"></a>00213         <span class="keywordflow">return</span> <span class="keyword">false</span>;
1088 <a name="l00214"></a>00214 }
1089 </pre></div>
1090 <p>
1091     </td>
1092   </tr>
1093 </table>
1094 <a class="anchor" name="Write_28std_3A_3Astring_20data_29"></a><!-- doxytag: member="InspSocket::Write" ref="Write_28std_3A_3Astring_20data_29" args="(std::string data)" --><p>
1095 <table class="mdTable" cellpadding="2" cellspacing="0">
1096   <tr>
1097     <td class="mdRow">
1098       <table cellpadding="0" cellspacing="0" border="0">
1099         <tr>
1100           <td class="md" nowrap valign="top">int InspSocket::Write           </td>
1101           <td class="md" valign="top">(&nbsp;</td>
1102           <td class="md" nowrap valign="top"><a class="el" href="namespaceirc.html#string">std::string</a>&nbsp;</td>
1103           <td class="mdname1" valign="top" nowrap> <em>data</em>          </td>
1104           <td class="md" valign="top">&nbsp;)&nbsp;</td>
1105           <td class="md" nowrap><code> [virtual]</code></td>
1106         </tr>
1107       </table>
1108     </td>
1109   </tr>
1110 </table>
1111 <table cellspacing="5" cellpadding="0" border="0">
1112   <tr>
1113     <td>
1114       &nbsp;
1115     </td>
1116     <td>
1117
1118 <p>
1119 Writes a <a class="el" href="namespaceirc.html#string">std::string</a> to the socket. 
1120 <p>
1121 No carriage returns or linefeeds are appended to the string. <dl compact><dt><b>Parameters:</b></dt><dd>
1122   <table border="0" cellspacing="2" cellpadding="0">
1123     <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>The data to send</td></tr>
1124   </table>
1125 </dl>
1126
1127 <p>
1128 Definition at line <a class="el" href="socket_8cpp-source.html#l00174">174</a> of file <a class="el" href="socket_8cpp-source.html">socket.cpp</a>.
1129 <p>
1130 References <a class="el" href="socket_8h-source.html#l00111">Buffer</a>, and <a class="el" href="socket_8cpp-source.html#l00181">FlushWriteBuffer()</a>.<div class="fragment"><pre class="fragment"><a name="l00175"></a>00175 {
1131 <a name="l00176"></a>00176         this-&gt;<a class="code" href="classInspSocket.html#Buffer">Buffer</a> = this-&gt;<a class="code" href="classInspSocket.html#Buffer">Buffer</a> + data;
1132 <a name="l00177"></a>00177         this-&gt;<a class="code" href="classInspSocket.html#FlushWriteBuffer_28_29">FlushWriteBuffer</a>();
1133 <a name="l00178"></a>00178         <span class="keywordflow">return</span> data.length();
1134 <a name="l00179"></a>00179 }
1135 </pre></div>
1136 <p>
1137     </td>
1138   </tr>
1139 </table>
1140 <hr><h2>Member Data Documentation</h2>
1141 <a class="anchor" name="addr"></a><!-- doxytag: member="InspSocket::addr" ref="addr" args="" --><p>
1142 <table class="mdTable" cellpadding="2" cellspacing="0">
1143   <tr>
1144     <td class="mdRow">
1145       <table cellpadding="0" cellspacing="0" border="0">
1146         <tr>
1147           <td class="md" nowrap valign="top">sockaddr_in <a class="el" href="classInspSocket.html#addr">InspSocket::addr</a><code> [private]</code>          </td>
1148         </tr>
1149       </table>
1150     </td>
1151   </tr>
1152 </table>
1153 <table cellspacing="5" cellpadding="0" border="0">
1154   <tr>
1155     <td>
1156       &nbsp;
1157     </td>
1158     <td>
1159
1160 <p>
1161 The host being connected to, in sockaddr form. 
1162 <p>
1163
1164 <p>
1165 Definition at line <a class="el" href="socket_8h-source.html#l00078">78</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1166 <p>
1167 Referenced by <a class="el" href="socket_8cpp-source.html#l00059">InspSocket()</a>.    </td>
1168   </tr>
1169 </table>
1170 <a class="anchor" name="addy"></a><!-- doxytag: member="InspSocket::addy" ref="addy" args="" --><p>
1171 <table class="mdTable" cellpadding="2" cellspacing="0">
1172   <tr>
1173     <td class="mdRow">
1174       <table cellpadding="0" cellspacing="0" border="0">
1175         <tr>
1176           <td class="md" nowrap valign="top">in_addr <a class="el" href="classInspSocket.html#addy">InspSocket::addy</a><code> [private]</code>          </td>
1177         </tr>
1178       </table>
1179     </td>
1180   </tr>
1181 </table>
1182 <table cellspacing="5" cellpadding="0" border="0">
1183   <tr>
1184     <td>
1185       &nbsp;
1186     </td>
1187     <td>
1188
1189 <p>
1190 The host being connected to, in in_addr form. 
1191 <p>
1192
1193 <p>
1194 Definition at line <a class="el" href="socket_8h-source.html#l00084">84</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1195 <p>
1196 Referenced by <a class="el" href="socket_8cpp-source.html#l00059">InspSocket()</a>.    </td>
1197   </tr>
1198 </table>
1199 <a class="anchor" name="Buffer"></a><!-- doxytag: member="InspSocket::Buffer" ref="Buffer" args="" --><p>
1200 <table class="mdTable" cellpadding="2" cellspacing="0">
1201   <tr>
1202     <td class="mdRow">
1203       <table cellpadding="0" cellspacing="0" border="0">
1204         <tr>
1205           <td class="md" nowrap valign="top"><a class="el" href="namespaceirc.html#string">std::string</a> <a class="el" href="classInspSocket.html#Buffer">InspSocket::Buffer</a><code> [private]</code>          </td>
1206         </tr>
1207       </table>
1208     </td>
1209   </tr>
1210 </table>
1211 <table cellspacing="5" cellpadding="0" border="0">
1212   <tr>
1213     <td>
1214       &nbsp;
1215     </td>
1216     <td>
1217
1218 <p>
1219 The output buffer for this socket. 
1220 <p>
1221
1222 <p>
1223 Definition at line <a class="el" href="socket_8h-source.html#l00111">111</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1224 <p>
1225 Referenced by <a class="el" href="socket_8cpp-source.html#l00181">FlushWriteBuffer()</a>, and <a class="el" href="socket_8cpp-source.html#l00174">Write()</a>.    </td>
1226   </tr>
1227 </table>
1228 <a class="anchor" name="client"></a><!-- doxytag: member="InspSocket::client" ref="client" args="" --><p>
1229 <table class="mdTable" cellpadding="2" cellspacing="0">
1230   <tr>
1231     <td class="mdRow">
1232       <table cellpadding="0" cellspacing="0" border="0">
1233         <tr>
1234           <td class="md" nowrap valign="top">sockaddr_in <a class="el" href="classInspSocket.html#client">InspSocket::client</a><code> [private]</code>          </td>
1235         </tr>
1236       </table>
1237     </td>
1238   </tr>
1239 </table>
1240 <table cellspacing="5" cellpadding="0" border="0">
1241   <tr>
1242     <td>
1243       &nbsp;
1244     </td>
1245     <td>
1246
1247 <p>
1248 Client sockaddr structure used by accept(). 
1249 <p>
1250
1251 <p>
1252 Definition at line <a class="el" href="socket_8h-source.html#l00124">124</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1253 <p>
1254 Referenced by <a class="el" href="socket_8cpp-source.html#l00216">Poll()</a>.    </td>
1255   </tr>
1256 </table>
1257 <a class="anchor" name="fd"></a><!-- doxytag: member="InspSocket::fd" ref="fd" args="" --><p>
1258 <table class="mdTable" cellpadding="2" cellspacing="0">
1259   <tr>
1260     <td class="mdRow">
1261       <table cellpadding="0" cellspacing="0" border="0">
1262         <tr>
1263           <td class="md" nowrap valign="top">int <a class="el" href="classInspSocket.html#fd">InspSocket::fd</a><code> [private]</code>          </td>
1264         </tr>
1265       </table>
1266     </td>
1267   </tr>
1268 </table>
1269 <table cellspacing="5" cellpadding="0" border="0">
1270   <tr>
1271     <td>
1272       &nbsp;
1273     </td>
1274     <td>
1275
1276 <p>
1277 The file descriptor of this socket. 
1278 <p>
1279
1280 <p>
1281 Definition at line <a class="el" href="socket_8h-source.html#l00054">54</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1282 <p>
1283 Referenced by <a class="el" href="socket_8cpp-source.html#l00138">Close()</a>, <a class="el" href="socket_8cpp-source.html#l00258">GetFd()</a>, and <a class="el" href="socket_8cpp-source.html#l00050">InspSocket()</a>.    </td>
1284   </tr>
1285 </table>
1286 <a class="anchor" name="host"></a><!-- doxytag: member="InspSocket::host" ref="host" args="" --><p>
1287 <table class="mdTable" cellpadding="2" cellspacing="0">
1288   <tr>
1289     <td class="mdRow">
1290       <table cellpadding="0" cellspacing="0" border="0">
1291         <tr>
1292           <td class="md" nowrap valign="top"><a class="el" href="namespaceirc.html#string">std::string</a> <a class="el" href="classInspSocket.html#host">InspSocket::host</a><code> [private]</code>          </td>
1293         </tr>
1294       </table>
1295     </td>
1296   </tr>
1297 </table>
1298 <table cellspacing="5" cellpadding="0" border="0">
1299   <tr>
1300     <td>
1301       &nbsp;
1302     </td>
1303     <td>
1304
1305 <p>
1306 The hostname connected to. 
1307 <p>
1308
1309 <p>
1310 Definition at line <a class="el" href="socket_8h-source.html#l00059">59</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.    </td>
1311   </tr>
1312 </table>
1313 <a class="anchor" name="ibuf_5B_36_35_35_33_35_5D"></a><!-- doxytag: member="InspSocket::ibuf" ref="ibuf_5B_36_35_35_33_35_5D" args="[65535]" --><p>
1314 <table class="mdTable" cellpadding="2" cellspacing="0">
1315   <tr>
1316     <td class="mdRow">
1317       <table cellpadding="0" cellspacing="0" border="0">
1318         <tr>
1319           <td class="md" nowrap valign="top">char <a class="el" href="classInspSocket.html#ibuf_5B_36_35_35_33_35_5D">InspSocket::ibuf</a>[65535]<code> [private]</code>          </td>
1320         </tr>
1321       </table>
1322     </td>
1323   </tr>
1324 </table>
1325 <table cellspacing="5" cellpadding="0" border="0">
1326   <tr>
1327     <td>
1328       &nbsp;
1329     </td>
1330     <td>
1331
1332 <p>
1333 Socket input buffer, used by read(). 
1334 <p>
1335 The class which extends InspSocket is expected to implement an extendable buffer which can grow much larger than 64k, this buffer is just designed to be temporary storage. space.
1336 <p>
1337 Definition at line <a class="el" href="socket_8h-source.html#l00106">106</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1338 <p>
1339 Referenced by <a class="el" href="socket_8cpp-source.html#l00155">Read()</a>.    </td>
1340   </tr>
1341 </table>
1342 <a class="anchor" name="IP"></a><!-- doxytag: member="InspSocket::IP" ref="IP" args="" --><p>
1343 <table class="mdTable" cellpadding="2" cellspacing="0">
1344   <tr>
1345     <td class="mdRow">
1346       <table cellpadding="0" cellspacing="0" border="0">
1347         <tr>
1348           <td class="md" nowrap valign="top"><a class="el" href="namespaceirc.html#string">std::string</a> <a class="el" href="classInspSocket.html#IP">InspSocket::IP</a><code> [private]</code>          </td>
1349         </tr>
1350       </table>
1351     </td>
1352   </tr>
1353 </table>
1354 <table cellspacing="5" cellpadding="0" border="0">
1355   <tr>
1356     <td>
1357       &nbsp;
1358     </td>
1359     <td>
1360
1361 <p>
1362 The IP address being connected to stored in string form for easy retrieval by accessors. 
1363 <p>
1364
1365 <p>
1366 Definition at line <a class="el" href="socket_8h-source.html#l00118">118</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1367 <p>
1368 Referenced by <a class="el" href="socket_8cpp-source.html#l00150">GetIP()</a>, and <a class="el" href="socket_8cpp-source.html#l00050">InspSocket()</a>.    </td>
1369   </tr>
1370 </table>
1371 <a class="anchor" name="length"></a><!-- doxytag: member="InspSocket::length" ref="length" args="" --><p>
1372 <table class="mdTable" cellpadding="2" cellspacing="0">
1373   <tr>
1374     <td class="mdRow">
1375       <table cellpadding="0" cellspacing="0" border="0">
1376         <tr>
1377           <td class="md" nowrap valign="top">socklen_t <a class="el" href="classInspSocket.html#length">InspSocket::length</a><code> [private]</code>          </td>
1378         </tr>
1379       </table>
1380     </td>
1381   </tr>
1382 </table>
1383 <table cellspacing="5" cellpadding="0" border="0">
1384   <tr>
1385     <td>
1386       &nbsp;
1387     </td>
1388     <td>
1389
1390 <p>
1391 Used by accept() to indicate the sizes of the sockaddr_in structures. 
1392 <p>
1393
1394 <p>
1395 Definition at line <a class="el" href="socket_8h-source.html#l00136">136</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1396 <p>
1397 Referenced by <a class="el" href="socket_8cpp-source.html#l00216">Poll()</a>.    </td>
1398   </tr>
1399 </table>
1400 <a class="anchor" name="port"></a><!-- doxytag: member="InspSocket::port" ref="port" args="" --><p>
1401 <table class="mdTable" cellpadding="2" cellspacing="0">
1402   <tr>
1403     <td class="mdRow">
1404       <table cellpadding="0" cellspacing="0" border="0">
1405         <tr>
1406           <td class="md" nowrap valign="top">int <a class="el" href="classInspSocket.html#port">InspSocket::port</a><code> [private]</code>          </td>
1407         </tr>
1408       </table>
1409     </td>
1410   </tr>
1411 </table>
1412 <table cellspacing="5" cellpadding="0" border="0">
1413   <tr>
1414     <td>
1415       &nbsp;
1416     </td>
1417     <td>
1418
1419 <p>
1420 The port connected to, or the port this socket is listening on. 
1421 <p>
1422
1423 <p>
1424 Definition at line <a class="el" href="socket_8h-source.html#l00065">65</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.    </td>
1425   </tr>
1426 </table>
1427 <a class="anchor" name="server"></a><!-- doxytag: member="InspSocket::server" ref="server" args="" --><p>
1428 <table class="mdTable" cellpadding="2" cellspacing="0">
1429   <tr>
1430     <td class="mdRow">
1431       <table cellpadding="0" cellspacing="0" border="0">
1432         <tr>
1433           <td class="md" nowrap valign="top">sockaddr_in <a class="el" href="classInspSocket.html#server">InspSocket::server</a><code> [private]</code>          </td>
1434         </tr>
1435       </table>
1436     </td>
1437   </tr>
1438 </table>
1439 <table cellspacing="5" cellpadding="0" border="0">
1440   <tr>
1441     <td>
1442       &nbsp;
1443     </td>
1444     <td>
1445
1446 <p>
1447 <a class="el" href="classServer.html">Server</a> sockaddr structure used by accept(). 
1448 <p>
1449
1450 <p>
1451 Definition at line <a class="el" href="socket_8h-source.html#l00130">130</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.    </td>
1452   </tr>
1453 </table>
1454 <a class="anchor" name="state"></a><!-- doxytag: member="InspSocket::state" ref="state" args="" --><p>
1455 <table class="mdTable" cellpadding="2" cellspacing="0">
1456   <tr>
1457     <td class="mdRow">
1458       <table cellpadding="0" cellspacing="0" border="0">
1459         <tr>
1460           <td class="md" nowrap valign="top"><a class="el" href="socket_8h.html#InspSocketState">InspSocketState</a> <a class="el" href="classInspSocket.html#state">InspSocket::state</a><code> [private]</code>          </td>
1461         </tr>
1462       </table>
1463     </td>
1464   </tr>
1465 </table>
1466 <table cellspacing="5" cellpadding="0" border="0">
1467   <tr>
1468     <td>
1469       &nbsp;
1470     </td>
1471     <td>
1472
1473 <p>
1474 The state for this socket, either listening, connecting, connected or error. 
1475 <p>
1476
1477 <p>
1478 Definition at line <a class="el" href="socket_8h-source.html#l00072">72</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1479 <p>
1480 Referenced by <a class="el" href="socket_8cpp-source.html#l00253">GetState()</a>, <a class="el" href="socket_8cpp-source.html#l00045">InspSocket()</a>, <a class="el" href="socket_8cpp-source.html#l00247">SetState()</a>, and <a class="el" href="socket_8cpp-source.html#l00197">Timeout()</a>.    </td>
1481   </tr>
1482 </table>
1483 <a class="anchor" name="timeout"></a><!-- doxytag: member="InspSocket::timeout" ref="timeout" args="" --><p>
1484 <table class="mdTable" cellpadding="2" cellspacing="0">
1485   <tr>
1486     <td class="mdRow">
1487       <table cellpadding="0" cellspacing="0" border="0">
1488         <tr>
1489           <td class="md" nowrap valign="top">bool <a class="el" href="classInspSocket.html#timeout">InspSocket::timeout</a><code> [private]</code>          </td>
1490         </tr>
1491       </table>
1492     </td>
1493   </tr>
1494 </table>
1495 <table cellspacing="5" cellpadding="0" border="0">
1496   <tr>
1497     <td>
1498       &nbsp;
1499     </td>
1500     <td>
1501
1502 <p>
1503 This value is true if the socket has timed out. 
1504 <p>
1505
1506 <p>
1507 Definition at line <a class="el" href="socket_8h-source.html#l00097">97</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1508 <p>
1509 Referenced by <a class="el" href="socket_8cpp-source.html#l00059">InspSocket()</a>, and <a class="el" href="socket_8cpp-source.html#l00197">Timeout()</a>.    </td>
1510   </tr>
1511 </table>
1512 <a class="anchor" name="timeout_5Fend"></a><!-- doxytag: member="InspSocket::timeout_end" ref="timeout_5Fend" args="" --><p>
1513 <table class="mdTable" cellpadding="2" cellspacing="0">
1514   <tr>
1515     <td class="mdRow">
1516       <table cellpadding="0" cellspacing="0" border="0">
1517         <tr>
1518           <td class="md" nowrap valign="top">time_t <a class="el" href="classInspSocket.html#timeout_5Fend">InspSocket::timeout_end</a><code> [private]</code>          </td>
1519         </tr>
1520       </table>
1521     </td>
1522   </tr>
1523 </table>
1524 <table cellspacing="5" cellpadding="0" border="0">
1525   <tr>
1526     <td>
1527       &nbsp;
1528     </td>
1529     <td>
1530
1531 <p>
1532 When this time is reached, the socket times out if it is in the CONNECTING state. 
1533 <p>
1534
1535 <p>
1536 Definition at line <a class="el" href="socket_8h-source.html#l00091">91</a> of file <a class="el" href="socket_8h-source.html">socket.h</a>.
1537 <p>
1538 Referenced by <a class="el" href="socket_8cpp-source.html#l00059">InspSocket()</a>, and <a class="el" href="socket_8cpp-source.html#l00197">Timeout()</a>.    </td>
1539   </tr>
1540 </table>
1541 <hr>The documentation for this class was generated from the following files:<ul>
1542 <li><a class="el" href="socket_8h-source.html">socket.h</a><li><a class="el" href="socket_8cpp-source.html">socket.cpp</a></ul>
1543 <hr size="1"><address style="align: right;"><small>Generated on Mon Dec 19 18:02:15 2005 for InspIRCd by&nbsp;
1544 <a href="http://www.doxygen.org/index.html">
1545 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4-20050815 </small></address>
1546 </body>
1547 </html>