Function SocketConnect() Professional

Connects a socket to a peer.

SocketConnect( <nSocket>         , ;
               [<nAddressFamily>], ;
               <xRemoteAddress>  , ;
               <nPort>           , ;
               [@<nError>]         ) --> lSuccess
This is a numeric socket descriptor previously created with SocketNew().
This parameter specifies the adress family to which the socket belongs to. Windows only supports #define constant AF_INET as value, which is the default.
The remote address can be specified either as a numeric address in network byte order, or as a character string. The latter can be coded as the DNS name of the computer running the remote process, or as the IP address in form of a dotted octet string.
This is the numeric port number on the local computer to bind the socket to.
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 .T. (true) if the socket is successfully connected, otherwise .F. (false) is returned.


This function establishes a connection to a remote process or computer. The parameter <nSocket> specifies a local, unconnected datagram or stream socket. If the socket is not bound, the operating system assigns unique values to it, and then marks the socket as bound. When the connection is successful, data can be sent or received via this socket.


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.