]>
Commit | Line | Data |
---|---|---|
d7ce7006 | 1 | /** @file\r |
2 | Implement the read API.\r | |
3 | \r | |
4 | Copyright (c) 2011, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include <SocketInternals.h>\r | |
16 | \r | |
17 | \r | |
18 | /**\r | |
19 | Read support routine for sockets\r | |
20 | \r | |
21 | @param [in] pDescriptor Descriptor address for the file\r | |
22 | @param [in] pOffset File offset\r | |
23 | @param [in] LengthInBytes Number of bytes to read\r | |
24 | @param [in] pBuffer Address of the buffer to receive the data\r | |
25 | \r | |
7dc13291 | 26 | @return The number of bytes read or -1 if an error occurs.\r |
d7ce7006 | 27 | \r |
28 | **/\r | |
29 | ssize_t\r | |
30 | BslSocketRead (\r | |
31 | struct __filedes *pDescriptor,\r | |
32 | off_t * pOffset,\r | |
33 | size_t LengthInBytes,\r | |
34 | void * pBuffer\r | |
35 | )\r | |
36 | {\r | |
37 | ssize_t BytesRead;\r | |
38 | \r | |
39 | //\r | |
40 | // Receive the data from the remote system\r | |
41 | //\r | |
42 | BytesRead = recvfrom ( pDescriptor->MyFD,\r | |
43 | pBuffer,\r | |
44 | LengthInBytes,\r | |
45 | 0,\r | |
46 | NULL,\r | |
47 | NULL );\r | |
48 | \r | |
49 | //\r | |
50 | // Return the number of bytes read\r | |
51 | //\r | |
52 | return BytesRead;\r | |
53 | }\r |