Function SocketSend() Professional

Sends data to a connected socket.

SocketSend( <nSocket>  , ;
            <cBuffer>  , ;
            [<nLength>], ;
            [<nFlag>]  , ;
            [@<nError>]  ) --> nBytesWritten
This is a numeric socket descriptor identifying a connected socket.
This is a character string holding the data to send.
Optionally, the number of bytes to send can be specified. This parameter defaults to Len(<cBuffer>).
#define constants from the file SOCKET.CH are used for this parameter. It specifies the way in which the call is made.
Constants for sending data.
Constant Description
MSG_NORMAL *) Sends regular data
MSG_DONTROUTE Specifies that the data should not be subject to routing.
MSG_OOB Sends out-of-band data (SOCK_STREAM only)
  1. default
If this parameter is passed by reference to the function, it gets assigned a numeric error code when the function fails. #define constants beginning with WSAE are available in the file SOCKET.CH to identify an error condition.

The function returns the number of bytes written to socket, or 0 in case of an error.


SocketSend() is used on connected datagram or stream sockets to write outgoing data on a socket. For datagram sockets, care must be taken not to exceed the maximum IP packet size of the underlying subnets. Excess data will be discarded.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.