Documentation
¶
Overview ¶
Package StreamPeerTCP provides methods for working with StreamPeerTCP object instances.
Index ¶
- type Advanced
- type Any
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsStreamPeer() StreamPeer.Instance
- func (self Instance) AsStreamPeerTCP() Instance
- func (self Instance) Bind(port int) error
- func (self Instance) ConnectToHost(host string, port int) error
- func (self Instance) DisconnectFromHost()
- func (self Instance) GetConnectedHost() string
- func (self Instance) GetConnectedPort() int
- func (self Instance) GetLocalPort() int
- func (self Instance) GetStatus() gdclass.StreamPeerTCPStatus
- func (self Instance) Poll() error
- func (self Instance) SetNoDelay(enabled bool)
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Instance ¶
type Instance [1]gdclass.StreamPeerTCP
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.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsStreamPeer ¶
func (self Instance) AsStreamPeer() StreamPeer.Instance
func (Instance) AsStreamPeerTCP ¶
func (Instance) Bind ¶
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.
func (Instance) ConnectToHost ¶
Connects to the specified [code]host:port[/code] pair. A hostname will be resolved if valid. Returns [constant OK] on success.
func (Instance) DisconnectFromHost ¶
func (self Instance) DisconnectFromHost()
Disconnects from host.
func (Instance) GetConnectedHost ¶
Returns the IP of this peer.
func (Instance) GetConnectedPort ¶
Returns the port of this peer.
func (Instance) GetLocalPort ¶
Returns the local port to which this peer is bound.
func (Instance) GetStatus ¶
func (self Instance) GetStatus() gdclass.StreamPeerTCPStatus
Returns the status of the connection, see [enum Status].
func (Instance) SetNoDelay ¶
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.
func (*Instance) UnsafePointer ¶
type Status ¶
type Status = gdclass.StreamPeerTCPStatus //gd:StreamPeerTCP.Status
const ( /*The initial status of the [StreamPeerTCP]. This is also the status after disconnecting.*/ StatusNone Status = 0 /*A status representing a [StreamPeerTCP] that is connecting to a host.*/ StatusConnecting Status = 1 /*A status representing a [StreamPeerTCP] that is connected to a host.*/ StatusConnected Status = 2 /*A status representing a [StreamPeerTCP] in error state.*/ StatusError Status = 3 )