#include <network.h>
Public Member Functions | |
NetworkClient (const std::string &host, UInt16 port) | |
Constructor. Create socket and connects to host on port. | |
virtual | ~NetworkClient () |
Destructor, close connection and destroy socket. | |
void | run (void) |
Run and return only when connection is closed. | |
bool | step (bool block=false, long timeout=0) |
Read data from socket and call incomingData. If block is true, wait until any data arrives. If block is false, wait timeout us at maximum. | |
Protected Member Functions | |
virtual void | incomingData (Socket *socket)=0 |
Called when datas are available on socket. If socket is closed in this method, connectionClosed is called. Must be implemented by subclass. | |
virtual void | connectionClosed (Socket *socket)=0 |
Called when connection is closed on socket. Must be implemented by subclass. | |
Protected Attributes | |
Socket * | socket |
The socket that connect to the server. |