WINDEX
|
Read/Write to TCP/IP socket, client or server. More...
#include <tcp.h>
Public Member Functions | |
void | server (const std::string &port, std::function< void(std::string &port)> connectHandler, std::function< void(std::string &port, const std::string &msg)> readHandler) |
Start server. More... | |
void | RetryConnectServer (bool f) |
Configure client() blocking. More... | |
void | client (const std::string &ipaddr, const std::string &port, std::function< void(std::string &port, const std::string &msg)> readHandler) |
Connect to server. More... | |
bool | isConnected () |
void | send (const std::string &msg) |
Send message to connected peer. | |
void | run () |
Start the windex event handler. More... | |
Read/Write to TCP/IP socket, client or server.
Events ( peer connection, read completion ) are handled by callbacks
This does not require a parent window and so is suitable for console applications
|
inline |
Connect to server.
[in] | ipaddr | |
[in] | port | |
[in] | readhandler | event handler to call when server sends a message |
|
inline |
Configure client() blocking.
true: keep trying until connection made ( default on construction ) false: if connection refused return after one attempt
|
inline |
Start the windex event handler.
This blocks!
Call this once when everything has been setup
This is used by console type applications. GUI applications should not call this They will call run on the main application window when setup is complete
|
inline |
Start server.
[in] | port | to listen for clients |
[in] | connectHandler | event handler to call when client connects |
[in] | readHandler | event handler to call when client sends a message |