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>recvmsg</strong></h4> | |
13 <p>The <b>recvmsg</b> method receives a valid message.</p> | |
14 | |
15 <div class="code">int recvmsg(<br /> | |
16 UDTSOCKET <font color="#FFFFFF">u</font>,<br /> | |
17 char* <font color="#FFFFFF">msg</font>,<br /> | |
18 int <font color="#FFFFFF">len</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>msg</em></dt> | |
26 <dd>[out] The buffer used to store incoming message.</dd> | |
27 <dt><em>len</em></dt> | |
28 <dd>[in] Length of the buffer.</dd> | |
29 </dl> | |
30 | |
31 <h5>Return Value</h5> | |
32 <p>On success, <b>recvmsg</b> returns the actual size of received message. Other
wise UDT::ERROR is returned and specific error information can be retrieved by <
a | |
33 href="error.htm">getlasterror</a>. If UDT_RCVTIMEO is set to a positive value, z
ero will be returned if no message is received before the timer expires.</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>ECONNLOST</td> | |
43 <td>2001</td> | |
44 <td>connection has been broken and no data left in receiver buffer.</td> | |
45 </tr> | |
46 <tr> | |
47 <td>ENOCONN</td> | |
48 <td>2002</td> | |
49 <td><i>u</i> is not connected.</td> | |
50 </tr> | |
51 <tr> | |
52 <td>EINVSOCK</td> | |
53 <td>5004</td> | |
54 <td><i>u</i> is not an valid socket.</td> | |
55 </tr> | |
56 <tr> | |
57 <td>ESTREAMILL</td> | |
58 <td>5009</td> | |
59 <td>cannot use <i>recvmsg</i> in SOCK_STREAM mode.</td> | |
60 </tr> | |
61 <tr> | |
62 <td>EASYNCRCV</td> | |
63 <td>6002</td> | |
64 <td><i>u</i> is non-blocking (UDT_RCVSYN = false) but no message is availabl
e.</td> | |
65 </tr> | |
66 </table> | |
67 | |
68 <h5>Description</h5> | |
69 <p>The <strong>recvmsg</strong> method reads a message from the protocol buffer.
The UDT socket must be in SOCK_DGRAM mode in order to send or receive messages.
Message is the minimum | |
70 data unit in this situation. Each <strong>recvmsg</strong> will read no more tha
n one message, even if the message is smaller than the size of <i>buf</i> and th
ere | |
71 are more messages available. On the other hand, if the <i>buf</i> is not enough
to hold the first message, only part of the message will be copied into the buff
er, | |
72 but the message will still be discarded after this <strong>recvmsg</strong> call
.</p> | |
73 <p>In blocking mode (default), <strong>recvmsg</strong> waits until there is a v
alid message received into the receiver buffer. In non-blocking mode, | |
74 <strong>recvmsg</strong></strong> returns immediately and returns error if no me
ssage available.</p> | |
75 <p>If UDT_RCVTIMEO is set and the socket is in blocking mode, <strong>recvmsg</s
trong> only waits a limited time specified by UDT_RCVTIMEO option. If there is s
till | |
76 no message available when the timer expires, zero will be returned. UDT_RCVTIMEO
has no effect for non-blocking socket.</p> | |
77 | |
78 <h5>See Also</h5> | |
79 <p><strong><a href="select.htm">select</a>, <a href="sendmsg.htm">send</a></stro
ng></p> | |
80 <p> </p> | |
81 | |
82 </body> | |
83 </html> | |
OLD | NEW |