W Wrapl, The Programming Language

Libraries:Gtk:Gio:GSocketListener

Types

T

Inherits from:

A T is an object that keeps track of a set of server sockets and helps you accept sockets from any of the socket, either sync or async.

If you want to implement a network server, also look at Gtk.Gio.GSocketService.T and Gtk.Gio.GThreadedSocketService.T which are subclass of T that makes this even easier.



Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New() : Gtk.Gio.GSocketListener.T

Creates a new T with no sockets to listen for. New listeners can be added with e.g. AddAddress or AddInetPort.

Returns a new T.


Methods

:Accept(self @ T, source_object @ Std.Object.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Blocks waiting for a client to connect to any of the sockets added to the listener. Returns a Gtk.Gio.GSocketConnection.T for the socket that was accepted.

If source_object is not NULL it will be filled out with the source object specified when the corresponding socket or address was added to the listener.

If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gtk.Gio.GIOErrorEnum.Cancelled will be returned.

listener a T
source_object location where GObject pointer will be stored, or NULL. [out][transfer none][allow-none]
cancellable optional Gtk.Gio.GCancellable.T object, NULL to ignore. [allow-none]
error Gtk.Glib.GError.T for error reporting, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:AcceptAsync(self @ T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T

This is the asynchronous version of Accept.

When the operation is finished callback will be called. You can then call AcceptSocket to get the result of the operation.

listener a T
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
callback a Gtk.Gio.GAsyncReadyCallback. [scope async]
user_data user data for the callback. [closure]


:AcceptFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, source_object @ Std.Object.T, error @ Std.Object.T) : Gtk.Gio.GSocketConnection.T

Finishes an async accept operation. See AcceptAsync

listener a T
result a Gtk.Gio.GAsyncResult.T.
source_object Optional GObject identifying this source. [out][transfer none][allow-none]
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns a Gtk.Gio.GSocketConnection.T on success, NULL on error. [transfer full]


:AcceptSocket(self @ T, source_object @ Std.Object.T, cancellable @ Gtk.Gio.GCancellable.T, error @ Std.Object.T) : Gtk.Gio.GSocket.T

Blocks waiting for a client to connect to any of the sockets added to the listener. Returns the Gtk.Gio.GSocket.T that was accepted.

If you want to accept the high-level Gtk.Gio.GSocketConnection.T, not a Gtk.Gio.GSocket.T, which is often the case, then you should use Accept instead.

If source_object is not NULL it will be filled out with the source object specified when the corresponding socket or address was added to the listener.

If cancellable is not NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gtk.Gio.GIOErrorEnum.Cancelled will be returned.

listener a T
source_object location where GObject pointer will be stored, or NULL. [out][transfer none][allow-none]
cancellable optional Gtk.Gio.GCancellable.T object, NULL to ignore. [allow-none]
error Gtk.Glib.GError.T for error reporting, or NULL to ignore.
Returns a Gtk.Gio.GSocket.T on success, NULL on error. [transfer full]


:AcceptSocketAsync(self @ T, cancellable @ Gtk.Gio.GCancellable.T, callback @ Std.Function.T, user_data) : Std.Object.T

This is the asynchronous version of AcceptSocket.

When the operation is finished callback will be called. You can then call AcceptSocketFinish to get the result of the operation.

listener a T
cancellable a Gtk.Gio.GCancellable.T, or NULL. [allow-none]
callback a Gtk.Gio.GAsyncReadyCallback. [scope async]
user_data user data for the callback. [closure]


:AcceptSocketFinish(self @ T, result @ Gtk.Gio.GAsyncResult.T, source_object @ Std.Object.T, error @ Std.Object.T) : Gtk.Gio.GSocket.T

Finishes an async accept operation. See AcceptSocketAsync

listener a T
result a Gtk.Gio.GAsyncResult.T.
source_object Optional GObject identifying this source. [out][transfer none][allow-none]
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns a Gtk.Gio.GSocket.T on success, NULL on error. [transfer full]


:AddAddress(self @ T, address @ Gtk.Gio.GSocketAddress.T, type @ Gtk.Gio.GSocketType.T, protocol @ Gtk.Gio.GSocketProtocol.T, source_object @ Gtk.GObject.Object.T, effective_address @ Std.Object.T, error @ Std.Object.T) : Std.Symbol.T

Creates a socket of type type and protocol protocol, binds it to address and adds it to the set of sockets we're accepting sockets from.

Note that adding an IPv6 address, depending on the platform, may or may not result in a listener that also accepts IPv4 connections. For more deterministic behavior, see AddInetPort.

source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

If successful and effective_address is non-NULL then it will be set to the address that the binding actually occurred at. This is helpful for determining the port number that was used for when requesting a binding to port 0 (ie: "any port"). This address, if requested, belongs to the caller and must be freed.

listener a T
address a Gtk.Gio.GSocketAddress.T
type a Gtk.Gio.GSocketType.T
protocol a Gtk.Gio.GSocketProtocol.T
source_object Optional GObject identifying this source. [allow-none]
effective_address location to store the address that was bound to, or NULL. [out][allow-none]
error Gtk.Glib.GError.T for error reporting, or NULL to ignore.
Returns TRUE on success, FALSE on error.


:AddAnyInetPort(self @ T, source_object @ Gtk.GObject.Object.T, error @ Std.Object.T) : Std.Integer.SmallT

Listens for TCP connections on any available port number for both IPv6 and IPv4 (if each is available).

This is useful if you need to have a socket for incoming connections but don't care about the specific port number.

source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

listener a T
source_object Optional GObject identifying this source. [allow-none]
error a Gtk.Glib.GError.T location to store the error occurring, or NULL to ignore.
Returns the port number, or 0 in case of failure.


:AddInetPort(self @ T, port @ Std.Integer.SmallT, source_object @ Gtk.GObject.Object.T, error @ Std.Object.T) : Std.Symbol.T

Helper function for AddAddress that creates a TCP/IP socket listening on IPv4 and IPv6 (if supported) on the specified port on all interfaces.

source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

listener a T
port an IP port number (non-zero)
source_object Optional GObject identifying this source. [allow-none]
error Gtk.Glib.GError.T for error reporting, or NULL to ignore.
Returns TRUE on success, FALSE on error.


:AddSocket(self @ T, socket @ Gtk.Gio.GSocket.T, source_object @ Gtk.GObject.Object.T, error @ Std.Object.T) : Std.Symbol.T

Adds socket to the set of sockets that we try to accept new clients from. The socket must be bound to a local address and listened to.

source_object will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.

listener a T
socket a listening Gtk.Gio.GSocket.T
source_object Optional GObject identifying this source. [allow-none]
error Gtk.Glib.GError.T for error reporting, or NULL to ignore.
Returns TRUE on success, FALSE on error.


:Close(self @ T) : Std.Object.T

Closes all the sockets in the listener.

listener a T


:Priv(self @ T) : Std.Object.T

:SetBacklog(self @ T, listen_backlog @ Std.Integer.SmallT) : Std.Object.T

Sets the listen backlog on the sockets in the listener.

See Gtk.Gio.GSocket.SetListenBacklog for details

listener a T
listen_backlog an integer


:setPriv(self @ T, value @ Std.Object.T) : Std.Object.T