TcpSocket.connect

Connect the socket to a remote peer.

In blocking mode, this function may take a while, especially if the remote peer is not reachable. The last parameter allows you to stop trying to connect after a given timeout.

If the socket was previously connected, it is first disconnected.

class TcpSocket
Status
connect
(
,
ushort port
,
Duration timeout = Duration.zero()
)

Parameters

host
Type: IpAddress

Address of the remote peer

port
Type: ushort

Port of the remote peer

timeout
Type: Duration

Optional maximum time to wait

Return Value

Type: Status

Status code.

Meta