Home |
Function net_connect |
Function net_connectEstablishes a connection to a remote host. int net_connect(SOCKET socket, BYTE * ip_addr, WORD port, int Seconds); ParameterssocketSocket returned by net_socket or socket. ip_addrPointer to the IP address to connect to in network byte order. portPort number in little endian byte order to connect to. SecondsTimeout in seconds. This parameter is ignored if zero, which means the operation waits indefinitely for sockets in blocking mode or returns immediately for sockets in non-blocking mode. Value RTIP_INF will wait indefinitely. return valueReturns 0 if successful, otherwise SOCKET_ERROR. If an error occurred, call xn_getlasterror and xn_geterror_string to return the error value. Section Error Codes further describes each error. This function calls function connect internally. For secure sockets, an encryption context is allocated and initialized, the server's certificate is downloaded, and the encryption method is negociated.
|