d7ce7006 |
1 | /** @file\r |
2 | Implement the send 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 | Send data using a network connection.\r |
20 | \r |
a88c3163 |
21 | The send routine queues data to the network for transmission.\r |
22 | This routine is typically used for SOCK_STREAM sockets where the target\r |
23 | system was specified in the ::connect call.\r |
24 | \r |
d7ce7006 |
25 | The\r |
26 | <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html">POSIX</a>\r |
27 | documentation is available online.\r |
28 | \r |
29 | @param [in] s Socket file descriptor returned from ::socket.\r |
30 | \r |
31 | @param [in] buffer Address of a buffer containing the data to send.\r |
7dc13291 |
32 | \r |
d7ce7006 |
33 | @param [in] length Length of the buffer in bytes.\r |
34 | \r |
35 | @param [in] flags Message control flags\r |
36 | \r |
a88c3163 |
37 | @return This routine returns the number of data bytes that were\r |
d7ce7006 |
38 | sent and -1 when an error occurs. In the case of\r |
a88c3163 |
39 | an error, ::errno contains more details.\r |
d7ce7006 |
40 | \r |
41 | **/\r |
42 | ssize_t\r |
43 | send (\r |
44 | int s,\r |
45 | CONST void * buffer,\r |
46 | size_t length,\r |
47 | int flags\r |
48 | )\r |
49 | {\r |
d7ce7006 |
50 | //\r |
486aace4 |
51 | // Send the data\r |
d7ce7006 |
52 | //\r |
486aace4 |
53 | return sendto ( s, buffer, length, flags, NULL, 0 );\r |
d7ce7006 |
54 | }\r |