Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function sends data on a connected socket.
int send ( SOCKET s , const char * buf , int len , int flags );
Parameters
Return Values
The total number of bytes sent, which can be less than the number indicated by lenfor nonblocking sockets, indicates that no errors occurred. SOCKET_ERROR indicates failure. To get a specific error value, call WSAGetLastError.
Remarks
For Infrared Sockets (IrSock), the Af_irda.h file must be explicitly included.
The sendfunction is used to write outgoing data on a connected socket. For message-oriented sockets, care must be taken not to exceed the maximum packet size of the underlying provider. If the data is too long to pass atomically through the underlying protocol, the error WSAEMSGSIZE is returned, and no data is transmitted.
The successful completion of a senddoes not indicate that the data was successfully delivered.
If no buffer space is available within the transport system to hold the data to be transmitted, sendwill block unless the socket has been placed in a nonblocking mode. On nonblocking stream oriented sockets, the number of bytes written can be between 1 and the requested length, depending on buffer availability on both client and server machines. The selectfunction can be used to determine when it is possible to send more data.
Calling sendwith a zero lenparameter is permissible and will be treated by implementations as successful. In such cases, sendwill return zero as a valid value. For message-oriented sockets, a zero-length transport datagram is sent.
The flagsparameter is used to influence the behavior of the function beyond the options specified for the associated socket. However, Windows CE silently ignores the MSG_DONTROUTE value and does not support MSG_OOB.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winsock.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
bind, recv, recvfrom, socket, select, sendto, shutdown, WSAStartup