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