nds2-client - ClientAdministrator
0.16.8
|
Functions | |
daq_listen_t * | daq_initialize (daq_listen_t *lstn, daq_t *daq, int *tcp_port, void *(*start_func)(void *)) |
Create a network listener thread. More... | |
int | daq_shutdown (daq_listen_t *lstn) |
Kill the listener thread. More... | |
The daq2_listen module contains the code to spawn a listener thread that can be used to receive data from the original NDS server. It was originally part of the Daqc API and shared the control structures. A listener is useful in cases where one or more streams of (usually online) data are sent to a port other than the control port to be processed by an asynchronous thread. Note that no alternate port capability is currently planned for NDS2 and that firewalls would interfere with any such activity crossing network borders. The listener code depends on Posix threads (pthreads) and is not available on VxWorks platforms.
A typical use of the NDS listener is as follows:
daq_listen_t* daq_initialize | ( | daq_listen_t * | lstn, |
daq_t * | daq, | ||
int * | tcp_port, | ||
void *(*)(void *) | start_func | ||
) |
Create a network listener thread.
Create network listener on `*tcp_port' that listens for DAQD server connections and spawns `start_func' as POSIX threads passing `daq' as the argument when connection is established. A `daq_t' structure is allocated and initialized if a NULL pointer is passed as `daq'.
lstn | Listener parameter/status structure. |
daq | Client structure. |
tcp_port | is set to the actual port used. Port number can be increased to allow more than one program copy on the same system. |
start_func | Pointer to the funtion to be executed asynchronously when a connection is accepted by the listener. |
int daq_shutdown | ( | daq_listen_t * | lstn | ) |
Kill the listener thread.
Kill listener thread by setting the "shutting_down" flag and then connection to the listener address. This relies on the fact that the interpreter thread (with which listener is synchronized) is finished and listener is blocked on the accept() right now. If this is too much to bother about you could just exit(). Not available on VXWORKS.
lstn | Pointer to listener status structure. |