| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or
g/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> | |
| 3 <head> | |
| 4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
| 5 <title> UDT Reference</title> | |
| 6 <link rel="stylesheet" href="udtdoc.css" type="text/css" /> | |
| 7 </head> | |
| 8 | |
| 9 <body> | |
| 10 <div class="ref_head"> UDT Reference: Functions</div> | |
| 11 | |
| 12 <h4 class="func_name"><strong>getpeername</strong></h4> | |
| 13 <p>The <b>getpeername</b> method retrieves the address informtion of the peer si
de of a connected UDT socket.</p> | |
| 14 | |
| 15 <div class="code">int getpeername(<br /> | |
| 16 UDTSOCKET <font color="#FFFFFF">u</font>,<br /> | |
| 17 struct sockaddr* <font color="#FFFFFF">name</font>,<br /> | |
| 18 int* <font color="#FFFFFF">namelen</font><br /> | |
| 19 );</div> | |
| 20 | |
| 21 <h5>Parameters</h5> | |
| 22 <dl> | |
| 23 <dt><i>u</i></dt> | |
| 24 <dd>[in] Descriptor identifying a connected socket.</dd> | |
| 25 <dt><em>name</em></dt> | |
| 26 <dd>[out] The structure to store the address of the peer.</dd> | |
| 27 <dt><em>addrlen</em></dt> | |
| 28 <dd>[in, out] pointer to the size of the <i>name</i> structure.</dd> | |
| 29 </dl> | |
| 30 | |
| 31 <h5>Return Value</h5> | |
| 32 <p>On success, <strong>getlasterror</strong> returns 0 and the peer address info
rmation is stored in <i>name</i>; otherwise it returns UDT::ERROR and the specif
ic error information can be | |
| 33 retrieved using <a href="error.htm">getlasterror</a>.</p> | |
| 34 | |
| 35 <table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCC
CCC"> | |
| 36 <tr> | |
| 37 <td width="17%" class="table_headline"><strong>Error Name</strong></td> | |
| 38 <td width="17%" class="table_headline"><strong>Error Code</strong></td> | |
| 39 <td width="83%" class="table_headline"><strong>Comment</strong></td> | |
| 40 </tr> | |
| 41 <tr> | |
| 42 <td>ENOCONN</td> | |
| 43 <td>2002</td> | |
| 44 <td><i>u</i> is not connected.</td> | |
| 45 </tr> | |
| 46 <tr> | |
| 47 <td>EINVPARAM</td> | |
| 48 <td>5003</td> | |
| 49 <td>Invalid parameters.</td> | |
| 50 </tr> | |
| 51 <tr> | |
| 52 <td>EINVSOCK</td> | |
| 53 <td>5004</td> | |
| 54 <td><i>u</i> is an invailid UDT socket.</td> | |
| 55 </tr> | |
| 56 </table> | |
| 57 | |
| 58 <h5>Description</h5> | |
| 59 <p>The <strong>getpeername</strong> retrieves the address of the peer side assoc
iated to the connection. The UDT socket must be connected at the time when this
method is called. The | |
| 60 <i>namelen</i> must provide the leangth of the <i>name</i> parameter, which shou
ld be enough to hold the address information. On return, <i>namelen</i> contains
the length of the result.</p> | |
| 61 | |
| 62 <h5>See Also</h5> | |
| 63 <p><strong><a href="listen.htm">listen</a>, <a href="connect.htm">connect</a>, <
a href="accept.htm">accept</a></strong></p> | |
| 64 <p> </p> | |
| 65 | |
| 66 </body> | |
| 67 </html> | |
| OLD | NEW |