HP-UX Reference (11i v3 07/02) - 5 Miscellaneous Topics (vol 9)
e
EvmConnection(5) EvmConnection(5)
Connection Context
This attribute is a handle to a connection returned when a connection is created. You must pass this handle
to all other functions you call which need to access the connection.
Connection Monitoring
Once you have established a connection, the API functions will take care of all communication activity with
the daemon. However, you must make sure that these functions get an opportunity to do their work when
activity occurs. EVM provides several ways for you to do this. The method you choose depends on the model
of your program.
• If your program is I/O driven, waiting for I/O to occur on one or more file descriptors, handling activity
as it occurs and then returning to wait for more I/O, it probably spends most of its time in a
select()
call. In this case, you should use EvmConnFdGet()
to establish which file descriptor the EVM con-
nection is using, and then include that file descriptor in your
select() read mask. When you detect
activity on the connection, invoke
EvmConnDispatch()
to handle the activity.
• If your program is driven purely by activity on a single EVM connection, you can let the API handle the
I/O entirely by using
EvmConnWait()
to wait for activity to occur on the connection. When the func-
tion returns, dispatch the I/O using
EvmConnDispatch()
, and then return to EvmConnWait().
• If your program is driven in some other way, and there are certain points (for example, at the end of
some control loop) at which you want to handle EVM activity, you can call
EvmConnCheck()
to check
for any outstanding activity. If this function indicates that there is something to do, you can call
EvmConnDispatch()
; otherwise you can continue immediately with normal processing.
Destroying a Connection
When you are finished with the connection, use
EvmConnDestroy()
to disconnect from the daemon. It
is important to check the return status for any failure each time you call a connection function and destroy
the connection if a failure occurred. The file descriptor associated with the connection remains open until
you destroy the connection even if I/O errors have been detected on the connection.
SEE ALSO
Functions
select(2).
Routines
EvmConnControl(3), EvmConnCreate(3), EvmConnFdGet(3), EvmConnCheck(3), EvmConnWait(3),
EvmConnDispatch(3), EvmConnDestroy(3).
Event Management
EVM(5).
Event Callback
EvmCallback(5).
EVM Events
EvmEvent(5).
HP-UX 11i Version 3: February 2007 − 2 − Hewlett-Packard Company 149