Public Member Functions

TRTK::Client Class Reference

Simple TCP/IP client. More...

#include <ClientServer.hpp>

List of all members.

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.

Detailed Description

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.

See also:
TRTK::Server
Author:
Christoph Haenisch
Version:
0.1.1
Date:
last changed on 2014-07-05

Definition at line 65 of file ClientServer.hpp.


Member Function Documentation

void TRTK::Client::connect ( std::string  host,
short  port 
)

Connects to a TCP/IP server.

Parameters:
[in]hostMust be given in dot-decimal notation.
[in]portPort 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.

Parameters:
[in]dataData sent to the server.
[in]sizeSize 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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines