## GdictClientContext GdictClientContext — Dictionary context implementing a RFC2229 compliant client. |

## Synopsis

                        GdictClientContextPrivate;
    #define             GDICT_CLIENT_CONTEXT_ERROR
    enum                GdictClientContextError;
    GQuark              gdict_client_context_error_quark    (void);
                        GdictClientContext;
    GdictContext*       gdict_client_context_new            (const gchar *hostname,
                                                             gint port);
    void                gdict_client_context_set_hostname   (GdictClientContext *context,
                                                             const gchar *hostname);
    const gchar*        gdict_client_context_get_hostname   (GdictClientContext *context);
    void                gdict_client_context_set_port       (GdictClientContext *context,
                                                             gint port);
    guint               gdict_client_context_get_port       (GdictClientContext *context);
    void                gdict_client_context_set_client     (GdictClientContext *context,
                                                             const gchar *client);
    const gchar*        gdict_client_context_get_client     (GdictClientContext *context);

## Description

GdictClientContext is an implementation of the GdictContext interface. It uses the Dictionary Protocol as defined by the RFC 2229 in order to connect to a dictionary server.

You should rarely instantiate this object directely: use an appropriate GdictSource instead.

## Details

### GdictClientContextPrivate

    typedef struct _GdictClientContextPrivate GdictClientContextPrivate;

### GDICT_CLIENT_CONTEXT_ERROR

    #define GDICT_CLIENT_CONTEXT_ERROR	(gdict_client_context_error_quark ())

### enum GdictClientContextError

    typedef enum {
      GDICT_CLIENT_CONTEXT_ERROR_SOCKET,
      GDICT_CLIENT_CONTEXT_ERROR_LOOKUP,
      GDICT_CLIENT_CONTEXT_ERROR_NO_CONNECTION,
      GDICT_CLIENT_CONTEXT_ERROR_SERVER_DOWN
    } GdictClientContextError;

These identify the various errors that can occur while calling GdictClientContext functions.

`GDICT_CLIENT_CONTEXT_ERROR_SOCKET` | Indicates an error occurred while accessing the communications socket.
`GDICT_CLIENT_CONTEXT_ERROR_LOOKUP` | Indicates an error occurred when looking up the dictionary server hostname.
`GDICT_CLIENT_CONTEXT_ERROR_NO_CONNECTION` | Indicates an error occurred while trying to establish the connection.
`GDICT_CLIENT_CONTEXT_ERROR_SERVER_DOWN` | Indicates that the server is unavailable at the moment.

### gdict_client_context_error_quark ()

    GQuark              gdict_client_context_error_quark    (void);

Returns : |

### GdictClientContext

    typedef struct {
    } GdictClientContext;

The GdictClientContext struct contains private data only.

### gdict_client_context_new ()

    GdictContext*       gdict_client_context_new            (const gchar *hostname,
                                                             gint port);

Creates a new GdictClientContext object for `hostname`. Use this object to connect and query the dictionary server using the Dictionary Protocol as defined by RFC 2229.

`hostname` : | the hostname of a dictionary server, or `NULL` for the default server
`port` : | port to be used when connecting to the dictionary server, or -1 for the default port
Returns : | the newly created GdictClientContext object. You should free it using `g_object_unref()`.

### gdict_client_context_set_hostname ()

    void                gdict_client_context_set_hostname   (GdictClientContext *context,
                                                             const gchar *hostname);

Sets `hostname` as the hostname of the dictionary server to be used. If `hostname` is `NULL`, the default dictionary server will be used.

`context` : | a GdictClientContext
`hostname` : | the hostname of a Dictionary server, or `NULL`

### gdict_client_context_get_hostname ()

    const gchar*        gdict_client_context_get_hostname   (GdictClientContext *context);

Gets the hostname of the dictionary server used by `context`.

`context` : | a GdictClientContext
Returns : | the hostname of a dictionary server. The returned string is owned by the GdictClientContext object and should never be modified or freed.

### gdict_client_context_set_port ()

    void                gdict_client_context_set_port       (GdictClientContext *context,
                                                             gint port);

Sets the port of the dictionary server to be used when connecting.

If `port` is -1, the default port will be used.

`context` : | a GdictClientContext
`port` : | port of the dictionary server to be used, or -1

### gdict_client_context_get_port ()

    guint               gdict_client_context_get_port       (GdictClientContext *context);

Gets the port of the dictionary server used by `context`.

`context` : | a GdictClientContext
Returns : | the number of the port.

### gdict_client_context_set_client ()

    void                gdict_client_context_set_client     (GdictClientContext *context,
                                                             const gchar *client);

Sets `client` as the client name to be used when advertising ourselves when a connection the the dictionary server has been established. If `client` is `NULL`, the default client name will be used.

`context` : | a GdictClientContext
`client` : | the client name to use, or `NULL`

### gdict_client_context_get_client ()

    const gchar*        gdict_client_context_get_client     (GdictClientContext *context);

Gets the client name used by `context`. See `gdict_client_context_set_client()`.

`context` : | a GdictClientContext
Returns : | the client name. The returned string is owned by the GdictClientContext object and should never be modified or freed.