]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/BsdSocketLib/recv.c
Fix @return Doxygen commands to be singular instead of plural.
[mirror_edk2.git] / StdLib / BsdSocketLib / recv.c
1 /** @file
2 Implement the recv API.
3
4 Copyright (c) 2011, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <SocketInternals.h>
16
17
18 /**
19 Receive data from a network connection.
20
21 The ::recv routine waits for receive data from a remote network
22 connection. The
23 <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html">POSIX</a>
24 documentation is available online.
25
26 @param [in] s Socket file descriptor returned from ::socket.
27
28 @param [in] buffer Address of a buffer to receive the data.
29
30 @param [in] length Length of the buffer in bytes.
31
32 @param [in] flags Message control flags
33
34 @return ::recv returns the number of valid bytes in the buffer,
35 zero if no data was received, and -1 when an error occurs.
36 In the case of an error, errno contains more details.
37
38 **/
39 ssize_t
40 recv (
41 int s,
42 void * buffer,
43 size_t length,
44 int flags
45 )
46 {
47 ssize_t BytesRead;
48
49 //
50 // Receive the data from the remote system
51 //
52 BytesRead = recvfrom ( s,
53 buffer,
54 length,
55 flags,
56 NULL,
57 NULL );
58
59 //
60 // Return the number of bytes read
61 //
62 return BytesRead;
63 }