📄 tcp_8c.html
字号:
<td class="mdname" nowrap> <em>sochandle</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>port</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Author: </b></dt><dd> <ul><li> Jari Lahti (<a href="mailto:jari.lahti@violasystems.com">jari.lahti@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>21.07.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>sochandle</em> </td><td>handle to socket to be placed to listen state </td></tr><tr><td valign=top><em>port</em> </td><td>TCP port number on which it should listen </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error <li> >=0 - OK (Socket put to listening state. Handle to socket returned)</ul></dl>This function will attempt to put socket to listening state. This is only possible if socket was defined as either <a class="el" href="tcp__ip_8h.html#a39">TCP_TYPE_SERVER</a> or <a class="el" href="tcp__ip_8h.html#a41">TCP_TYPE_CLIENT_SERVER</a>. If basic correctness checks pass, socket is put to listening mode and corresponding tcb entry is initialized. <p>Definition at line <a class="el" href="tcp_8c-source.html#l00290">290</a> of file <a class="el" href="tcp_8c-source.html">tcp.c</a>.<p>References <a class="el" href="structtcb.html#m16">tcb::event_listener</a>, <a class="el" href="tcp__ip_8h-source.html#l00622">tcb::flags</a>, <a class="el" href="tcp__ip_8h-source.html#l00625">tcb::locport</a>, <a class="el" href="tcp__ip_8h-source.html#l00627">tcb::myflags</a>, <a class="el" href="tcp__ip_8h-source.html#l00632">tcb::receive_next</a>, <a class="el" href="tcp__ip_8h-source.html#l00623">tcb::rem_ip</a>, <a class="el" href="tcp__ip_8h-source.html#l00624">tcb::remport</a>, <a class="el" href="tcp__ip_8h-source.html#l00635">tcb::retries_left</a>, <a class="el" href="tcp__ip_8h-source.html#l00629">tcb::send_mtu</a>, <a class="el" href="tcp__ip_8h-source.html#l00628">tcb::send_next</a>, <a class="el" href="tcp__ip_8h-source.html#l00626">tcb::send_unacked</a>, <a class="el" href="tcp__ip_8h-source.html#l00609">tcb::state</a>, <a class="el" href="tcp__ip_8h-source.html#l00335">TCP_STATE_CLOSED</a>, <a class="el" href="tcp__ip_8h-source.html#l00336">TCP_STATE_LISTENING</a>, <a class="el" href="tcp__ip_8h-source.html#l00334">TCP_STATE_RESERVED</a>, <a class="el" href="tcp__ip_8h-source.html#l00359">TCP_STATE_TIMED_WAIT</a>, <a class="el" href="tcp__ip_8h-source.html#l00310">TCP_TYPE_SERVER</a>, and <a class="el" href="tcp__ip_8h-source.html#l00621">tcb::type</a>.<p>Referenced by <a class="el" href="http__server_8c-source.html#l00093">https_init()</a>. </td> </tr></table><a name="a6" doxytag="tcp.c::tcp_connect"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> INT8 tcp_connect </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">INT8 </td> <td class="mdname" nowrap> <em>sochandle</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT32 </td> <td class="mdname" nowrap> <em>ip</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>rport</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>myport</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Author: </b></dt><dd> <ul><li> Jari Lahti (<a href="mailto:jari.lahti@violasystems.com">jari.lahti@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>21.07.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>sochandle</em> </td><td>handle to socket to be used for connection establishment </td></tr><tr><td valign=top><em>ip</em> </td><td>remote IP address to connect to </td></tr><tr><td valign=top><em>rport</em> </td><td>remote port number to connect to </td></tr><tr><td valign=top><em>myport</em> </td><td>local port to use for connection. This value can be specified directly or, if a value of 0 is given, TCP module will determine local TCP port automatically. </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error <li> >=0 - OK (Connection establishment procedure started. Socket handle returned.)</ul></dl>Invoke this function to start connection establishment procedure towards remote host over some socket. This is only possible if socket was defined as either <a class="el" href="tcp__ip_8h.html#a40">TCP_TYPE_CLIENT</a> or <a class="el" href="tcp__ip_8h.html#a41">TCP_TYPE_CLIENT_SERVER</a>. Function will make some basic checks and if everything is OK, corresponding tcb socket entry will be initialized and connection procedure started. <p>Definition at line <a class="el" href="tcp_8c-source.html#l00377">377</a> of file <a class="el" href="tcp_8c-source.html">tcp.c</a>.<p>References <a class="el" href="structtcb.html#m16">tcb::event_listener</a>, <a class="el" href="tcp__ip_8h-source.html#l00622">tcb::flags</a>, <a class="el" href="tcp__ip_8h-source.html#l00625">tcb::locport</a>, <a class="el" href="tcp__ip_8h-source.html#l00627">tcb::myflags</a>, <a class="el" href="tcp__ip_8h-source.html#l00623">tcb::rem_ip</a>, <a class="el" href="tcp__ip_8h-source.html#l00624">tcb::remport</a>, <a class="el" href="tcp__ip_8h-source.html#l00629">tcb::send_mtu</a>, <a class="el" href="tcp__ip_8h-source.html#l00628">tcb::send_next</a>, <a class="el" href="tcp__ip_8h-source.html#l00626">tcb::send_unacked</a>, <a class="el" href="tcp__ip_8h-source.html#l00609">tcb::state</a>, <a class="el" href="tcp_8c-source.html#l02511">tcp_getfreeport()</a>, <a class="el" href="tcp_8c-source.html#l02346">tcp_initseq()</a>, <a class="el" href="tcp_8c-source.html#l02455">tcp_newstate()</a>, <a class="el" href="tcp_8c-source.html#l02253">tcp_sendcontrol()</a>, <a class="el" href="tcp__ip_8h-source.html#l00335">TCP_STATE_CLOSED</a>, <a class="el" href="tcp__ip_8h-source.html#l00336">TCP_STATE_LISTENING</a>, <a class="el" href="tcp__ip_8h-source.html#l00334">TCP_STATE_RESERVED</a>, <a class="el" href="tcp__ip_8h-source.html#l00343">TCP_STATE_SYN_SENT</a>, <a class="el" href="tcp__ip_8h-source.html#l00320">TCP_TYPE_CLIENT</a>, and <a class="el" href="tcp__ip_8h-source.html#l00621">tcb::type</a>. </td> </tr></table><a name="a7" doxytag="tcp.c::tcp_send"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> INT16 tcp_send </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">INT8 </td> <td class="mdname" nowrap> <em>sockethandle</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 * </td> <td class="mdname" nowrap> <em>buf</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>blen</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>dlen</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Author: </b></dt><dd> <ul><li> Jari Lahti (<a href="mailto:jari.lahti@violasystems.com">jari.lahti@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>25.07.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>sockethandle</em> </td><td>handle to TCP socket to be used for sending data </td></tr><tr><td valign=top><em>buf</em> </td><td>pointer to data buffer (start of user data) </td></tr><tr><td valign=top><em>blen</em> </td><td>buffer length in bytes (without space reserved at the beginning of buffer for headers) </td></tr><tr><td valign=top><em>dlen</em> </td><td>length of user data to be sent (in bytes) </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> -1 - Error <li> >0 - OK (number represents number of bytes actually sent)</ul></dl><dl compact><dt><b>Warning: </b></dt><dd> <ul><li> <em>buf</em> parameter is a pointer to data to be sent in user buffer. But note that there <b>MUST</b> be sufficient free buffer space before that data for TCP header (of MIN_TCP_HLEN size).</ul></dl>Invoke this function to initiate data sending over TCP connection established over a TCP socket. Since data is not buffered (in order to reduce RAM memory consumption) new data can not be sent until data that was previously sent is acknowledged. So, application knows when it can send new data either by: <ul><li> waiting for TCP_EVENT_ACK in event_listener function <li> invoking tcp_check_send() function to check if it is possible to send data </ul><p>Definition at line <a class="el" href="tcp_8c-source.html#l00481">481</a> of file <a class="el" href="tcp_8c-source.html">tcp.c</a>.<p>References <a class="el" href="tcp__ip_8h-source.html#l00627">tcb::myflags</a>, <a class="el" href="tcp_8c-source.html#l02119">process_tcp_out()</a>, <a class="el" href="tcp__ip_8h-source.html#l00629">tcb::send_mtu</a>, <a class="el" href="tcp__ip_8h-source.html#l00628">tcb::send_next</a>, <a class="el" href="tcp__ip_8h-source.html#l00626">tcb::send_unacked</a>, <a class="el" href="tcp__ip_8h-source.html#l00609">tcb::state</a>, and <a class="el" href="tcp__ip_8h-source.html#l00362">TCP_STATE_CONNECTED</a>. </td> </tr></table><a name="a8" doxytag="tcp.c::tcp_close"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> INT8 tcp_close </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">INT8 </td> <td class="mdname1" valign="top" nowrap> <em>sochandle</em> </td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -