A stream peer that handles TCP connections.
A stream peer that handles TCP connections. This object can be used to connect to TCP servers, or also is returned by a TCP server. [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
Opens the TCP socket, and binds it to the specified local address. This method is generally not needed, and only used to force the subsequent call to [method connect_to_host] to use the specified [param host] and [param port] as source address. This can be desired in some NAT punchthrough techniques, or when forcing the source network interface.
Connects to the specified [code]host:port[/code] pair. A hostname will be resolved if valid. Returns [constant OK] on success.
Disconnects from host.
Returns the IP of this peer.
Returns the port of this peer.
Returns the local port to which this peer is bound.
Returns the status of the connection, see [enum Status].
Poll the socket, updating its state. See [method get_status].
If [param enabled] is [code]true[/code], packets will be sent immediately. If [param enabled] is [code]false[/code] (the default), packet transfers will be delayed and combined using [url=https://en.wikipedia.org/wiki/Nagle%27s_algorithm]Nagle's algorithm[/url]. [b]Note:[/b] It's recommended to leave this disabled for applications that send large packets or need to transfer a lot of data, as enabling this can decrease the total available bandwidth.
The initial status of the [StreamPeerTCP]. This is also the status after disconnecting.
A status representing a [StreamPeerTCP] that is connecting to a host.
A status representing a [StreamPeerTCP] that is connected to a host.
A status representing a [StreamPeerTCP] in error state.