![]() |
libcyberradio
22.01.24
|
Client socket class. More...
#include <ClientSocket.h>
Public Member Functions | |
| ClientSocket (const std::string &hostname, unsigned int port, bool debug=true) | |
| Constructs a ClientSocket object. More... | |
| virtual | ~ClientSocket () |
| Destroys a ClientSocket object. | |
| bool | isConnected (void) |
| Gets whether or not the socket is connected. More... | |
| bool | connectToServer (void) |
| Connects to the server. More... | |
| bool | disconnect (void) |
| Disconnects from the server. More... | |
| bool | sendCmd (const std::string &cmd) |
| Sends a command to the server. More... | |
| bool | getRsp (BasicStringList &rsp, float timeout) |
| Gets a command response from the server. More... | |
| bool | sendCmdAndGetRsp (const std::string &cmd, BasicStringList &rsp, float timeout, bool print) |
| Sends a command to the server and gets the response. More... | |
| bool | sendCmdAndGetRsp (const std::string &cmd, BasicStringList &rsp, float timeout) |
| Sends a command to the server and gets the response. More... | |
Client socket class.
Definition at line 43 of file ClientSocket.h.
| ClientSocket | ( | const std::string & | hostname, |
| unsigned int | port, | ||
| bool | debug = true |
||
| ) |
Constructs a ClientSocket object.
| hostname | Host name |
| port | UDP port |
| debug | Whether or not to produce debug output |
Definition at line 19 of file ClientSocket.cpp.
| bool connectToServer | ( | void | ) |
Connects to the server.
Definition at line 32 of file ClientSocket.cpp.
| bool disconnect | ( | void | ) |
Disconnects from the server.
Definition at line 81 of file ClientSocket.cpp.
| bool getRsp | ( | BasicStringList & | rsp, |
| float | timeout | ||
| ) |
Gets a command response from the server.
| rsp | A list of response strings |
| timeout | Response timeout, in seconds |
Definition at line 107 of file ClientSocket.cpp.
|
inline |
Gets whether or not the socket is connected.
Definition at line 62 of file ClientSocket.h.
| bool sendCmd | ( | const std::string & | cmd | ) |
Sends a command to the server.
| cmd | The command string to send |
Definition at line 99 of file ClientSocket.cpp.
| bool sendCmdAndGetRsp | ( | const std::string & | cmd, |
| BasicStringList & | rsp, | ||
| float | timeout, | ||
| bool | |||
| ) |
Sends a command to the server and gets the response.
| cmd | The command string to send |
| rsp | A list of response strings |
| timeout | Response timeout, in seconds |
| Whether or not to print the result |
Definition at line 126 of file ClientSocket.cpp.
| bool sendCmdAndGetRsp | ( | const std::string & | cmd, |
| BasicStringList & | rsp, | ||
| float | timeout | ||
| ) |
Sends a command to the server and gets the response.
| cmd | The command string to send |
| rsp | A list of response strings |
| timeout | Response timeout, in seconds |
Definition at line 122 of file ClientSocket.cpp.