Function SocketConnect() Professional

Connects a socket to a peer.

Syntax
SocketConnect( <nSocket>         , ;
               [<nAddressFamily>], ;
               <xRemoteAddress>  , ;
               <nPort>           , ;
               [@<nError>]         ) --> lSuccess
Parameters
<nSocket>
This is a numeric socket descriptor previously created with SocketNew().
<nAddressFamily>
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.
<xRemoteAddress>
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.
<nPort>
This is the numeric port number on the local computer to bind the socket to.
<nError>
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.
Return

The function returns .T. (true) if the socket is successfully connected, otherwise .F. (false) is returned.

Description

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.

Feedback

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.