Gambas Documentation - /comp/gb.net/socket/connect

/comp/gb.net/socket/connect

# Socket.Connect (gb.net)

Sub Connect ( [ HostOrPath As String, Port As Integer ] )

Use this method to establish a TCP or Local (Unix) connection with a remote TCP or Local server.

You can use this method only when Status value is zero or lesser than zero (previous error), otherwise an error will raise.

## Local connection

To start an Unix connection you will only pass the first argument:

- HostOrPath is the UNIX socket path to connect to. (Relative paths are allowed here).

## Network connection

To start a TCP connection you have to pass the two arguments:

- HostOrPath is the host name, or host IP to connect to.

- Port is the number of the TCP port to connect to (1 - 65535).