TCPServer

package
v0.0.0-...-7325ca5 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 19 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 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) 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) Stop

func (self Instance) Stop()

Stops listening.

func (Instance) TakeConnection

func (self Instance) TakeConnection() [1]gdclass.StreamPeerTCP

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

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

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