Infinityd.TcpServer

g GObject.Object GObject.Object Infinityd.TcpServer Infinityd.TcpServer GObject.Object->Infinityd.TcpServer

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

bind ()

close ()

get_keepalive ()

open ()

set_keepalive (keepalive)

Virtual Methods

Inherited:

GObject.Object (7)

do_error (error)

do_new_connection (connection)

Properties

Name

Type

Flags

Short Description

io

Infinity.Io

r/w/co

I/O handler

keepalive

Infinity.Keepalive

r/w

Keepalive settings for accepted connections

local-address

Infinity.IpAddress

r/w

Address to bind to

local-port

int

r/w

Port to bind to

status

Infinityd.TcpServerStatus

r

Status of the TCP server

Signals

Inherited:

GObject.Object (1)

Name

Short Description

error

new-connection

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Infinityd.TcpServer(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Infinityd.TcpServerClass

bind()
Raises:

GLib.Error

Returns:

True on success, or False if an error occurred.

Return type:

bool

Binds the server to the address and port given by the Infinityd.TcpServer :local-address and Infinityd.TcpServer :local-port properties. If the former is None, it will bind on all interfaces on IPv4. If the latter is 0, a random available port will be assigned. If the function fails, False is returned and an error is set.

self must be in Infinityd.TcpServerStatus.CLOSED state for this function to be called.

close()

Closes a TCP server that is open or bound.

get_keepalive()
Returns:

A Infinity.Keepalive representing the keepalive configuration for accepted connections, owned by self.

Return type:

Infinity.Keepalive

Obtains the current keepalive settings for accepted connections.

open()
Raises:

GLib.Error

Returns:

True on success, or False if an error occurred.

Return type:

bool

Attempts to open self. This means binding its local address and port if not already (see Infinityd.TcpServer.bind()) and accepting incoming connections.

self needs to be in Infinityd.TcpServerStatus.CLOSED or %INFD_TCP_SERVER_BOUND status for this function to be called. If self's status is Infinityd.TcpServerStatus.CLOSED, then Infinityd.TcpServer.bind() is called before actually opening the server.

set_keepalive(keepalive)
Parameters:

keepalive (Infinity.Keepalive) – The keepalive settings for accepted connections.

Sets the keepalive settings for new connections accepted by the server.

do_error(error) virtual
Parameters:

error (GLib.Error) –

do_new_connection(connection) virtual
Parameters:

connection (Infinity.TcpConnection) –

Signal Details

Infinityd.TcpServer.signals.error(tcp_server, object)
Signal Name:

error

Flags:

RUN_LAST

Parameters:
Infinityd.TcpServer.signals.new_connection(tcp_server, object)
Signal Name:

new-connection

Flags:

RUN_LAST

Parameters:

Property Details

Infinityd.TcpServer.props.io
Name:

io

Type:

Infinity.Io

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

I/O handler

Infinityd.TcpServer.props.keepalive
Name:

keepalive

Type:

Infinity.Keepalive

Default Value:

None

Flags:

READABLE, WRITABLE

Keepalive settings for accepted connections

Infinityd.TcpServer.props.local_address
Name:

local-address

Type:

Infinity.IpAddress

Default Value:

None

Flags:

READABLE, WRITABLE

Address to bind to

Infinityd.TcpServer.props.local_port
Name:

local-port

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Port to bind to

Infinityd.TcpServer.props.status
Name:

status

Type:

Infinityd.TcpServerStatus

Default Value:

Infinityd.TcpServerStatus.CLOSED

Flags:

READABLE

Status of the TCP server