SocketListener
Object Hierarchy:
Description:
public class SocketListener :
Object
A SocketListener 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 SocketService and
ThreadedSocketService which are subclass of SocketListener
that makes this even easier.
Content:
Properties:
Creation methods:
Methods:
- public SocketConnection accept (out Object source_object = null, Cancellable? cancellable = null) throws Error
Blocks waiting for a client to connect to any of the sockets added
to the listener.
- public async SocketConnection accept_async (Cancellable? cancellable = null, out Object source_object = null) throws Error
This is the asynchronous version of
accept.
- public Socket accept_socket (out Object source_object = null, Cancellable? cancellable = null) throws Error
Blocks waiting for a client to connect to any of the sockets added
to the listener.
- public async Socket accept_socket_async (Cancellable? cancellable = null, out Object source_object = null) throws Error
- public bool add_address (SocketAddress address, SocketType type, SocketProtocol protocol, Object? source_object, out SocketAddress effective_address) throws Error
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.
- public uint16 add_any_inet_port (Object? source_object) throws Error
Listens for TCP connections on any available port number for both
IPv6 and IPv4 (if each is available).
- public bool add_inet_port (uint16 port, Object? source_object) throws Error
Helper function for
add_address that creates a TCP/IP socket listening on IPv4 and
IPv6 (if supported) on the specified port on all interfaces.
- public bool add_socket (Socket socket, Object? source_object) throws Error
Adds socket
to the set of sockets that we try to accept
new clients from.
- public virtual void changed ()
- public void close ()
Closes all the sockets in the listener.
- public void set_backlog (int listen_backlog)
Sets the listen backlog on the sockets in the listener.
Inherited Members:
All known members inherited from class GLib.Object