10. Events
Prev | Chapter 3. ZOOM | Next

## 10. Events

If you're developing non-blocking applications, you have to deal with events.

        int ZOOM_event(int no, ZOOM_connection *cs);

The `ZOOM_event` executes pending events for a number of connections. Supply the number of connections in `no` and an array of connections in `cs` (`cs[0] ... cs[no-1]`). A pending event could be sending a search, receiving a response, etc. When an event has occurred for one of the connections, this function returns a positive integer `n` denoting that an event occurred for connection `cs[n-1]`. When no events are pending for the connections, a value of zero is returned. To ensure that all outstanding requests are performed, call this function repeatedly until zero is returned.

If `ZOOM_event` returns, and returns non-zero, the last event that occurred can be expected.

        int ZOOM_connection_last_event(ZOOM_connection cs);

`ZOOM_connection_last_event` returns an event type (integer) for the last event.

Table 3.13. ZOOM Event IDs

Event | Description
--- | ---
ZOOM_EVENT_NONE | No event has occurred
ZOOM_EVENT_CONNECT | TCP/IP connect has initiated
ZOOM_EVENT_SEND_DATA | Data has been transmitted (sending)
ZOOM_EVENT_RECV_DATA | Data has been received
ZOOM_EVENT_TIMEOUT | Timeout
ZOOM_EVENT_UNKNOWN | Unknown event
ZOOM_EVENT_SEND_APDU | An APDU has been transmitted (sending)
ZOOM_EVENT_RECV_APDU | An APDU has been received
ZOOM_EVENT_RECV_RECORD | A result-set record has been received
ZOOM_EVENT_RECV_SEARCH | A search result has been received

Prev | Up | Next
9. Query conversions | Home | Chapter 4. Generic server