RRTCPListener

Name

RRTCPListener -- TCP/IP listener.

Synopsis



struct      RRTCPListenerPriv;
RRListener* rr_tcp_listener_new             (RRProfileRegistry *profreg,
                                             const gchar *hostname,
                                             gint port,
                                             GError **error);
gboolean    rr_tcp_listener_unlisten        (RRTCPListener *tcpl,
                                             GError **error);

Description

RRTCPListener is used to create listening BEEP peers.

/* Initialize roadrunner */
if (!rr_init (&argc, &argv, &error))
	g_error ("rr_init failed: s\n", error->message);

/* Select a few profiles we want to support */
profreg = rr_profile_registry_new();
rr_profile_registry_add_profile (profreg, RR_TYPE_SIMPLE, NULL);  

/* Listen... */
if ((listener = rr_tcp_listener_new (profreg, "localhost", 10289, 
				     &error)) == NULL)
	g_error ("listen failed: s\n", error->message);

if (!rr_wait_until_done (&error))
	g_error ("rr_wait failed: s\n", error->message);

Details

struct RRTCPListenerPriv

struct RRTCPListenerPriv;


rr_tcp_listener_new ()

RRListener* rr_tcp_listener_new             (RRProfileRegistry *profreg,
                                             const gchar *hostname,
                                             gint port,
                                             GError **error);

Creates a new RRTCPListener instance that listens for new connection on address hostname and port port.

NOTE: RRTCPListener will decrease the refcount on profreg when the listener object is finalized.

profreg :

a list of profiles this listener should support.

hostname :

hostname to bind to

port :

TCP/IP port to listen on.

error :

location to return an error of type G_IO_ERROR, RR_ERROR or RR_BEEP_ERROR.

Returns :

a new RRTCPListener object


rr_tcp_listener_unlisten ()

gboolean    rr_tcp_listener_unlisten        (RRTCPListener *tcpl,
                                             GError **error);

Stop listening for new connections.

NOTE: the RRTCPListener object isn't unrefed.

tcpl :

A RRTCPListener object

error :

location to return an error of type G_IO_ERROR, RR_ERROR or RR_BEEP_ERROR.

Returns :

TRUE on success, FALSE on failure.

See Also

RRListener, RRTCPConnection and RRProfileRegistry.