11 #ifndef INCLUDED_LIBCYBERRADIO_NDR651_CLIENTSOCKET_H 12 #define INCLUDED_LIBCYBERRADIO_NDR651_CLIENTSOCKET_H 19 #include <sys/socket.h> 20 #include <arpa/inet.h> 23 #include <boost/thread/mutex.hpp> 24 #include "LibCyberRadio/Common/BasicList.h" 26 #define RX_BUFF_SIZE 1024 52 ClientSocket(
const std::string& hostname,
unsigned int port,
78 bool sendCmd(
const std::string& cmd);
95 float timeout,
bool print);
111 std::string _serverHostname;
115 char _rxBuff[RX_BUFF_SIZE];
116 void _clearRxBuff(
void) { memset(_rxBuff, 0, RX_BUFF_SIZE); }
117 void _tcpRx(
void) { recv(_sockfd, _rxBuff, RX_BUFF_SIZE, 0); }
119 boost::mutex _trxMutex;
bool connectToServer(void)
Connects to the server.
bool disconnect(void)
Disconnects from the server.
bool sendCmdAndGetRsp(const std::string &cmd, BasicStringList &rsp, float timeout, bool print)
Sends a command to the server and gets the response.
bool isConnected(void)
Gets whether or not the socket is connected.
bool sendCmd(const std::string &cmd)
Sends a command to the server.
BASIC_LIST_CONTAINER< std::string > BasicStringList
Type representing a list of strings.
Defines functionality for LibCyberRadio applications.
bool getRsp(BasicStringList &rsp, float timeout)
Gets a command response from the server.
ClientSocket(const std::string &hostname, unsigned int port, bool debug=true)
Constructs a ClientSocket object.
virtual ~ClientSocket()
Destroys a ClientSocket object.