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