23 lines
395 B
C++
23 lines
395 B
C++
|
#include "muduo/net/EventLoop.h"
|
||
|
#include "muduo/net/TcpServer.h"
|
||
|
|
||
|
using namespace muduo;
|
||
|
using namespace muduo::net;
|
||
|
|
||
|
void onConnection(const TcpConnectionPtr& conn)
|
||
|
{
|
||
|
if (conn->connected())
|
||
|
{
|
||
|
conn->shutdown();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
EventLoop loop;
|
||
|
TcpServer server(&loop, InetAddress(1079), "Finger");
|
||
|
server.setConnectionCallback(onConnection);
|
||
|
server.start();
|
||
|
loop.loop();
|
||
|
}
|