23 lines
395 B
C++
Raw Permalink Normal View History

2024-03-08 14:03:37 +08:00
#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();
}