An example of how to use the Async::TcpClient class
#include <iostream>
using namespace std;
class MyClass :
public sigc::trackable
{
public:
{
con->connected.connect(
mem_fun(*
this, &MyClass::onConnected));
con->disconnected.connect(
mem_fun(*
this, &MyClass::onDisconnected));
con->dataReceived.connect(
mem_fun(*
this, &MyClass::onDataReceived));
con->connect();
}
{
delete con;
}
private:
{
con->
write(
"GET /\n", 6);
}
{
Application::app().quit();
}
{
char *
str =
static_cast<char *
>(buf);
}
};
{
}
The core class for writing asyncronous cpp applications.
Contains a class for creating TCP client connections.
An application class for writing non GUI applications.
void exec(void)
Execute the application main loop.
A class for creating a TCP client connection.
A class for handling exiting TCP connections.
const IpAddress & remoteHost(void) const
Return the IP-address of the remote host.
DisconnectReason
Reason code for disconnects.
virtual int write(const void *buf, int count)
Write data to the TCP connection.
Namespace for the asynchronous programming classes.