TCP Stream peer.
    public class StreamPeerTCP : StreamPeer

TCP Stream peer. This object can be used to connect to TCP servers, or also is returned by a TCP server.

Inheritance Chain


    public StreamPeerTCP()


    public Error ConnectToHost(string host, int port)

Connect to the specified host:port pair. A hostname will be resolved if valid. Returns OK on success or FAILED on failure.

    public void DisconnectFromHost()

Disconnect from host.

    public string GetConnectedHost()

Return the IP of this peer.

    public int GetConnectedPort()

Return the port of this peer.

    public Status GetStatus()

Return the status of the connection, see Status.

    public bool IsConnectedToHost()

Returns true if this peer is currently connected to a host, false otherwise.

    public void SetNoDelay(bool enabled)

Disable Nagle algorithm to improve latency for small packets.

Note that for applications that send large packets, or need to transfer a lot of data, this can reduce total bandwidth.

Inner Types


Name Value Description
None 0 The initial status of the [code]StreamPeerTCP[/code], also the status after a disconnect.
Connecting 1 A status representing a [code]StreamPeerTCP[/code] that is connecting to a host.
Connected 2 A status representing a [code]StreamPeerTCP[/code] that is connected to a host.
Error 3 A status representing a [code]StreamPeerTCP[/code] in error state.