FiberSocketConnection.connect

Attempts to connect to the remote host, suspending the fiber if establishing the connection does not immediately succeed or fail. If a connection to the same address and port is already established, the Already flag is set in the return value. If a connection to a different address and port is already established, this connection is closed and a new connection is opened.

  1. ConnectionStatus connect(cstring address, ushort port, bool force)
    class FiberSocketConnection(bool IPv6 = false)
    override
    ConnectionStatus
    connect
    (,
    ushort port
    ,
    bool force = false
    )
  2. ConnectionStatus connect(InAddr address, bool force)

Parameters

address cstring

remote IP address

port ushort

remote TCP port

force bool

false: don't call connect() if currently connected to the same address and port; true: always call connect()

Return Value

Type: ConnectionStatus

ConnectionStatus.Connected if the connection was newly established or ConnectionStatus.Connected | ConnectionStatus.Already if the connection was already established.

Throws

- SocketError (IOException) on fatal I/O error, - IOWarning if the remote hung up.

Meta