#include <iostream>
#include <cassert>
using namespace std;
class MyClass :
public sigc::trackable
{
public:
{
mem_fun(*
this, &MyClass::onClientConnected));
mem_fun(*
this, &MyClass::onClientDisconnected));
cout <<
"Start AsyncFramedTcpClient_demo in another window to transfer "
"some frames to the server" <<
endl;
}
{
}
private:
{
<<
server->numberOfClients() <<
" clients connected\n";
}
{
<<
server->numberOfClients() <<
" clients connected\n";
}
{
cout <<
"Received a frame with " << buf.size() <<
" bytes of data\n";
if (buf.size() == 4)
{
std::string
cmd(buf.begin(), buf.end());
Application::app().quit();
}
else
{
for (
size_t i=0;
i<buf.size(); ++
i)
{
}
}
}
};
{
}
The core class for writing asyncronous cpp applications.
A TCP connection with framed instead of streamed content.
A class for creating a TCP server.
An application class for writing non GUI applications.
void exec(void)
Execute the application main loop.
A TCP connection with framed instead of streamed content.
sigc::signal< void, FramedTcpConnection *, std::vector< uint8_t > & > frameReceived
A signal that is emitted when a frame has been received on the connection.
void connect(const std::string &remote_host, uint16_t remote_port)
Connect to the remote host.
A class for creating a TCP client connection.
const IpAddress & remoteHost(void) const
Return the IP-address of the remote host.
uint16_t remotePort(void) const
Return the remote port used.
DisconnectReason
Reason code for disconnects.
Namespace for the asynchronous programming classes.