Documentation
¶
Overview ¶
Package TCPServer provides methods for working with TCPServer object instances.
Index ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsTCPServer() Instance
- func (self Instance) GetLocalPort() int
- func (self Instance) ID() ID
- func (self Instance) IsConnectionAvailable() bool
- func (self Instance) IsListening() bool
- func (self Instance) Listen(port int) error
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) Stop()
- func (self Instance) TakeConnection() StreamPeerTCP.Instance
- func (self Instance) Virtual(name string) reflect.Value
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 Expanded ¶
func (Expanded) Listen ¶
Listen on the [param port] binding to [param bind_address]. If [param bind_address] is set as [code]"*"[/code] (default), the server will listen on all available addresses (both IPv4 and IPv6). If [param bind_address] is set as [code]"0.0.0.0"[/code] (for IPv4) or [code]"::"[/code] (for IPv6), the server will listen on all available addresses matching that IP type. If [param bind_address] is set to any valid address (e.g. [code]"192.168.1.101"[/code], [code]"::1"[/code], etc.), the server will only listen on the interface with that address (or fail if no interface with the given address exists).
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsTCPServer ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
A TCP server. Listens to connections on a port and returns a [StreamPeerTCP] when it gets an incoming connection. [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) AsTCPServer ¶
func (Instance) GetLocalPort ¶
Returns the local port this server is listening to.
func (Instance) IsConnectionAvailable ¶
Returns [code]true[/code] if a connection is available for taking.
func (Instance) IsListening ¶
Returns [code]true[/code] if the server is currently listening for connections.
func (Instance) Listen ¶
Listen on the [param port] binding to [param bind_address]. If [param bind_address] is set as [code]"*"[/code] (default), the server will listen on all available addresses (both IPv4 and IPv6). If [param bind_address] is set as [code]"0.0.0.0"[/code] (for IPv4) or [code]"::"[/code] (for IPv6), the server will listen on all available addresses matching that IP type. If [param bind_address] is set to any valid address (e.g. [code]"192.168.1.101"[/code], [code]"::1"[/code], etc.), the server will only listen on the interface with that address (or fail if no interface with the given address exists).
func (Instance) TakeConnection ¶
func (self Instance) TakeConnection() StreamPeerTCP.Instance
If a connection is available, returns a StreamPeerTCP with the connection.