Writing a Generic Client

Tutorial: Writing a client — How to write a client

Writing a Client

This section of the tutorial describes how to write a client.

The first step in implementing a client is figuring out how to determine the host and port to connect to:

  • Is there a default host? If not, the host should either be determined programmatically (eg via an environment variable, a configuration file, a command-line parameter, or some other way), or the host may be a standard IP address or name. You may have to wait on DNS lookups; use the gsk_name_resolve function to lookup the name.

  • The port often defaults to a service-specific default port. Traditionally /etc/services gives a map from the port number to service name. More often, the default port is just hardcoded into the program.

Example

TODO: write this!