Method Stdio.File()->connect()
- Method connect
int
connect(string
host
,int
|string
port
,void
|string
client
,void
|int
|string
client_port
)- Description
This function connects a socket previously created with open_socket() to a remote socket through TCP/IP. The
host
argument is the hostname or IP number of the remote machine. A local IP and port can be explicitly bound by specifyingclient
andclient_port
.- Returns
This function returns 1 for success, 0 otherwise.
- Note
In nonblocking mode
0
(zero) may be returned and errno() set toEWOULDBLOCK
orWSAEWOULDBLOCK
. This should not be regarded as a connection failure. In nonblocking mode you need to wait for a write or close callback before you know if the connection failed or not.- See also
query_address()
, async_connect(), connect_unix()