+++ /dev/null
-/** @file\r
- Implement the recv API.\r
-\r
- Copyright (c) 2011, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <SocketInternals.h>\r
-\r
-\r
-/**\r
- Receive data from a network connection.\r
-\r
- The recv routine waits for receive data from a remote network\r
- connection. This routine is typically used for SOCK_STREAM\r
- because it waits for receive data from the target system specified\r
- in the ::connect call.\r
-\r
- The\r
- <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html">POSIX</a>\r
- documentation is available online.\r
-\r
- @param [in] s Socket file descriptor returned from ::socket.\r
-\r
- @param [in] buffer Address of a buffer to receive the data.\r
-\r
- @param [in] length Length of the buffer in bytes.\r
-\r
- @param [in] flags Message control flags\r
-\r
- @return This routine returns the number of valid bytes in the buffer,\r
- zero if no data was received, and -1 when an error occurs.\r
- In the case of an error, ::errno contains more details.\r
-\r
- **/\r
-ssize_t\r
-recv (\r
- int s,\r
- void * buffer,\r
- size_t length,\r
- int flags\r
- )\r
-{\r
- ssize_t BytesRead;\r
-\r
- //\r
- // Receive the data from the remote system\r
- //\r
- BytesRead = recvfrom ( s,\r
- buffer,\r
- length,\r
- flags,\r
- NULL,\r
- NULL );\r
-\r
- //\r
- // Return the number of bytes read\r
- //\r
- return BytesRead;\r
-}\r