You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
870 B

// gpp tcpServer_main.cpp -o client -I../include ../src/Logger.cpp ../src/TcpClient.cpp
#include "TcpServer.hpp"
#include "Logger.hpp"
#include <iostream>
#include <string>
class EchoTcpServer : public TcpServer
{
public:
EchoTcpServer ( const std::string host,
const std::string port,
const int maxClients = 5 )
: TcpServer(host, port, maxClients)
{
TRACE;
}
void msgArrived(const int clientSocket,
const std::string msg)
{
TRACE;
LOG( Logger::DEBUG, std::string("Got msg: ").append(msg).c_str() );
}
};
int main( int argc, char * argv[] )
{
Logger::createInstance();
Logger::init(std::cout);
Logger::setLogLevel(Logger::FINEST);
EchoTcpServer tcpServer("localhost", "4455");
tcpServer.start();
sleep(10);
tcpServer.stop();
Logger::destroy();
return 0;
}