GLBasic User Manual

Main sections


sock% = SOCK_TCPCONNECT(server$, port%, timeout%=5000)

With this command you create a socket that tries to connect to a server (it is the opposite of SOCK_TCPLISTEN()).
server$ is a computer name or an IP address, for example "", "PC-GF" or "".
With port% you can specify which port you want to connect to. This will correspond with the port that the server called SOCK_TCPLISTEN to listen on.
The return value is either a valid socket or -1, indicating an error.
You can retrieve any error messages with NETGETLASTERROR$().

the timeout% specifies after how many millseconds of no connection an error due to timeout will be returned.

See also...