Simple TCP/IP client. More...
#include <ClientServer.hpp>
Public Member Functions | |
| Client () | |
| Constructs a Client object. | |
| virtual | ~Client () |
| Destroys the Client object. | |
| void | connect (std::string host, short port) |
| Connects to a TCP/IP server. | |
| void | disconnect () |
| Closes the current connection to the TCP/IP server. | |
| std::pair< char *, size_t > | request (const char *data, size_t size) |
| Carries out a server request. | |
Simple TCP/IP client.
This class allows creating a simple client by just deriving from it. For examples, please have a look at the detailed documentation section of TRTK::Server.
Definition at line 65 of file ClientServer.hpp.
| void TRTK::Client::connect | ( | std::string | host, |
| short | port | ||
| ) |
Connects to a TCP/IP server.
| [in] | host | Must be given in dot-decimal notation. |
| [in] | port | Port on which the server is running. |
Definition at line 272 of file ClientServer.cpp.
| std::pair< char *, size_t > TRTK::Client::request | ( | const char * | data, |
| size_t | size | ||
| ) |
Carries out a server request.
| [in] | data | Data sent to the server. |
| [in] | size | Size of the block of data. |
This function is used to carry out server requests. The server response is returned in the form of a std::pair consisting of a pointer to the block of data (on the heap) and its size. The memory must be freed by the client using delete[].
Note, at most 65536 bytes can be sent, otherwise sending must be serialized.
Definition at line 346 of file ClientServer.cpp.
Documentation generated by Doxygen