#include <NDS2Socket.hh>

Public Member Functions | |
| NDS2Socket (void) | |
| NDS2Socket (const std::string &ipaddr, int ipport=NDS2_PORT, long RcvBufferLen=16384) | |
| ~NDS2Socket (void) | |
| int | open (const std::string &ipaddr, int ipport=NDS2_PORT, long bufsize=16384) |
| void | close () |
| void | flush () |
| int | Available (chantype typ, long gps, std::vector< DAQDChannel > &list, wait_time timeout=-1) |
| List all known channels. | |
| int | GetData (wait_time timeout=-1) |
| Get a data block from the server. | |
| int | RequestOnlineData (double stride=1.0, wait_time timeout=-1) |
| int | RequestData (unsigned long start, unsigned long duration, wait_time timeout=-1) |
| int | StopWriter (void) |
| int | Times (chantype typ, unsigned long &start, unsigned long &duration, wait_time timeout=-1) |
| int | WaitforData (bool poll) |
NDS2Socket provides a client interface to the Network Data Server. The server provides data in the CDS proprietary format or as standard frames. The interface may also be used to list channel names, or to specify the channels to be read in.
| NDS2Socket::NDS2Socket | ( | void | ) |
Construct an unopened socket.
| NDS2Socket::NDS2Socket | ( | const std::string & | ipaddr, | |
| int | ipport = NDS2_PORT, |
|||
| long | RcvBufferLen = 16384 | |||
| ) | [explicit] |
Create a socket and connect it to a server. The network address argument has the same syntax as that passed to NDS2Socket::open().
| NDS2Socket::~NDS2Socket | ( | void | ) |
Disconnect and close a socket.
| int NDS2Socket::open | ( | const std::string & | ipaddr, | |
| int | ipport = NDS2_PORT, |
|||
| long | bufsize = 16384 | |||
| ) | [virtual] |
Open an existing socket and connect it to a server. The argument, ipaddr, specifies the IP address of the node on which the network data server is running. It may be specified either as a symbolic name or as four numeric fields separated by dots. open() returns zero if successful, a positive non-zero error code if one was returned by DAQD or -1.
Implements DAQC_api.
| void NDS2Socket::close | ( | ) | [virtual] |
Disconnect and close a socket.
Implements DAQC_api.
| void NDS2Socket::flush | ( | ) | [virtual] |
flushes the input data from the socket.
Implements DAQC_api.
| int NDS2Socket::Available | ( | chantype | typ, | |
| long | gps, | |||
| std::vector< DAQDChannel > & | list, | |||
| wait_time | timeout = -1 | |||
| ) | [virtual] |
List all known channels.
The names, sample rates, etc. of all channels known by the server are copied into the channel vector. Available() returns the number of entries found or -1 if an error occurred.
| typ | Channel type. | |
| gps | Time. | |
| list | Vector to receive the list of channels. | |
| timeout | Maximm time to wait for a resoinse. |
Implements DAQC_api.
| int NDS2Socket::GetData | ( | wait_time | timeout = -1 |
) | [virtual] |
Get a data block from the server.
Receive block of data in the CDS proprietary format. A single block of data (including the header) is received and stored in an internal buffer.
| timeout | nnumber of seconds to time out. |
Reimplemented from DAQC_api.
| int NDS2Socket::RequestOnlineData | ( | double | stride = 1.0, |
|
| wait_time | timeout = -1 | |||
| ) | [virtual] |
Start reading CDS data. The network data server is requested to start a net-writer task. Only channels explicitly specified by AddChannel() will be written.
Implements DAQC_api.
| int NDS2Socket::RequestData | ( | unsigned long | start, | |
| unsigned long | duration, | |||
| wait_time | timeout = -1 | |||
| ) | [virtual] |
Start reading CDS data. The network data server is requested to start a net-writer task for past data. Start time and duration are given in GPS seconds. Only channels explicitly specified by AddChannel() will be written.
Implements DAQC_api.
| int NDS2Socket::StopWriter | ( | void | ) | [virtual] |
Stop a data writer. This function effectively countermands the RequestXXX() functions. StopWriter returns either the server response code or -1 if no writer has been requested.
Implements DAQC_api.
| int NDS2Socket::Times | ( | chantype | typ, | |
| unsigned long & | start, | |||
| unsigned long & | duration, | |||
| wait_time | timeout = -1 | |||
| ) | [virtual] |
Known time intervals. The network data server is requested to return start time and duration of the data stored on disk.
Reimplemented from DAQC_api.
| int NDS2Socket::WaitforData | ( | bool | poll | ) | [virtual] |
Wait for data to arrive. Execution is blocked until data are available to the socket. This can be used to wait for data after a request has been made. The calling function can then e.g. allocate a buffer before calling GetData(), GetName() or GetFrame(). If poll is true the function returns immediately with 1 if data is ready, or 0 if not.
Implements DAQC_api.
1.5.4