void onConnection(const TcpConnectionPtr& pTcpConn) { if (pTcpConn->IsConnected()) { printf("onConnection(): tid=%d new connection [%s] from %s\n" , CurrentThread::GetTid() , pTcpConn->GetName().c_str() , pTcpConn->GetPeerAddress().ToHostPort().c_str()); } else { printf("onConnection(): tid=%d connection [%s] is down\n", CurrentThread::GetTid(), pTcpConn->GetName().c_str()); } }