ZOOM::connection

YAZ++ User's Guide and Reference
Prev | Chapter 2. ZOOM-C++ | Next

# `ZOOM::connection`

A `ZOOM::connection` object represents an open connection to a Z39.50 server. Such a connection is forged by constructing a `connection` object.

The class has this declaration:

        class connection {
        public:
          connection (const char *hostname, int portnum);
          ~connection ();
          const char *option (const char *key) const;
          const char *option (const char *key, const char *val);
        };

When a new `connection` is created, the hostname and port number of a Z39.50 server must be supplied, and the network connection is forged and wrapped in the new object. If the connection can't be established - perhaps because the hostname couldn't be resolved, or there is no server listening on the specified port - then an `exception` is thrown.

The only other methods on a `connection` object are for getting and setting options. Any name-value pair of strings may be set as options, and subsequently retrieved, but certain options have special meanings which are understood by the ZOOM code and affect the behaviour of the object that carries them. For example, the value of the `databaseName` option is used as the name of the database to query when a search is executed against the `connection`. For a full list of such special options, see the ZOOM abstract API and the ZOOM-C documentation (links below).

## References

- Section 3.2 (Connection) of the ZOOM Abstract API

- The Connections section of the ZOOM-C documentation

Prev | Home | Next
ZOOM-C++ | Up | `ZOOM::query` and subclasses