#include <iostream>
using namespace std;
class MyClass :
public sigc::trackable
{
public:
{
mem_fun(*
this, &MyClass::onClientConnected));
mem_fun(*
this, &MyClass::onClientDisconnected));
cout <<
"Connect using: \"telnet localhost 12345\" from "
"another console\n";
}
{
}
private:
{
<<
server->numberOfClients() <<
" clients connected\n";
con->
write(
"Hello, client!\n", 15);
}
{
<<
server->numberOfClients() <<
" clients connected\n";
}
{
char *
str =
static_cast<char *
>(buf);
if (
server->numberOfClients() > 1)
{
}
}
};
{
}
The core class for writing asyncronous cpp applications.
A class for creating a TCP server.
An application class for writing non GUI applications.
void exec(void)
Execute the application main loop.
void connect(const std::string &remote_host, uint16_t remote_port)
Connect to the remote host.
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.
uint16_t remotePort(void) const
Return the remote port used.
DisconnectReason
Reason code for disconnects.
sigc::signal< int, TcpConnection *, void *, int > dataReceived
A signal that is emitted when data has been received on the connection.
virtual int write(const void *buf, int count)
Write data to the TCP connection.
Namespace for the asynchronous programming classes.