TCPServer

package
v0.0.0-...-a7442fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package TCPServer provides methods for working with TCPServer object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsTCPServer() Instance
}

type Expanded

type Expanded [1]gdclass.TCPServer

func (Expanded) Listen

func (self Expanded) Listen(port int, bind_address string) error

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

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsTCPServer

func (self *Extension[T]) AsTCPServer() Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.TCPServer

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 New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsTCPServer

func (self Instance) AsTCPServer() Instance

func (Instance) GetLocalPort

func (self Instance) GetLocalPort() int

Returns the local port this server is listening to.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsConnectionAvailable

func (self Instance) IsConnectionAvailable() bool

Returns [code]true[/code] if a connection is available for taking.

func (Instance) IsListening

func (self Instance) IsListening() bool

Returns [code]true[/code] if the server is currently listening for connections.

func (Instance) Listen

func (self Instance) Listen(port int) error

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) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Stop

func (self Instance) Stop()

Stops listening.

func (Instance) TakeConnection

func (self Instance) TakeConnection() StreamPeerTCP.Instance

If a connection is available, returns a StreamPeerTCP with the connection.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL