当前位置: 首页>>代码示例>>C++>>正文


C++ TcpConnectionPtr::getServerConnCount方法代码示例

本文整理汇总了C++中TcpConnectionPtr::getServerConnCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TcpConnectionPtr::getServerConnCount方法的具体用法?C++ TcpConnectionPtr::getServerConnCount怎么用?C++ TcpConnectionPtr::getServerConnCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TcpConnectionPtr的用法示例。


在下文中一共展示了TcpConnectionPtr::getServerConnCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onTcpConnected

void AppBusiness::onTcpConnected(const TcpConnectionPtr& connection)
{
    logger().writeFmt("onTcpConnected (%s) (ConnCount: %d)",
        connection->getPeerAddr().getDisplayStr().c_str(),
        connection->getServerConnCount());

    connection->recv();
}
开发者ID:Elvins,项目名称:ise,代码行数:8,代码来源:chargen_client.cpp

示例2: onTcpConnected

//-----------------------------------------------------------------------------
// 描述: 接受了一个新的TCP连接
//-----------------------------------------------------------------------------
void AppBusiness::onTcpConnected(const TcpConnectionPtr& connection)
{
    logger().writeFmt("onTcpConnected (%s) (ConnCount: %d)",
                      connection->getPeerAddr().getDisplayStr().c_str(),
                      connection->getServerConnCount());

    string msg = "Welcome to the simple echo server, type 'quit' to exit.\r\n";
    connection->send(msg.c_str(), msg.length());
}
开发者ID:joydit,项目名称:ise,代码行数:12,代码来源:echo_server.cpp

示例3: onTcpConnected

void ServerModule_Daytime::onTcpConnected(const TcpConnectionPtr& connection)
{
    logger().writeFmt("onTcpConnected (%s) (ConnCount: %d)",
                      connection->getPeerAddr().getDisplayStr().c_str(),
                      connection->getServerConnCount());

    string msg = DateTime::now().toDateTimeString() + "\n";
    connection->send(msg.c_str(), msg.length());
}
开发者ID:joydit,项目名称:ise,代码行数:9,代码来源:svr_mod_daytime.cpp

示例4: onTcpConnected

void ServerModule_Chargen::onTcpConnected(const TcpConnectionPtr& connection)
{
    logger().writeFmt("onTcpConnected (%s) (ConnCount: %d)",
        connection->getPeerAddr().getDisplayStr().c_str(),
        connection->getServerConnCount());

    connection->setNoDelay(true);

    connection->recv();
    connection->send(message_.c_str(), message_.length());
}
开发者ID:mfc10001,项目名称:baoluo,代码行数:11,代码来源:svr_mod_chargen.cpp

示例5: onTcpConnected

void AppBusiness::onTcpConnected(const TcpConnectionPtr& connection)
{
    const int MAX_CONN_COUNT = 3;

    logger().writeFmt("onTcpConnected (%s) (ConnCount: %d)",
        connection->getPeerAddr().getDisplayStr().c_str(),
        connection->getServerConnCount());

    int connCount = connection->getServerConnCount();
    if (connCount > MAX_CONN_COUNT)
    {
        logger().writeFmt("Too many connections. (ConnCount: %d)", connCount);
        connection->disconnect();
    }
    else
    {
        string msg = "Welcome to the simple echo server, type 'quit' to exit.\r\n";
        connection->send(msg.c_str(), msg.length());
    }
}
开发者ID:Elvins,项目名称:ise,代码行数:20,代码来源:echo_server.cpp

示例6: onTcpConnected

//-----------------------------------------------------------------------------
// 描述: 接受了一个新的TCP连接
//-----------------------------------------------------------------------------
void AppBusiness::onTcpConnected(const TcpConnectionPtr& connection)
{
    logger().writeFmt("onTcpConnected (%s) (ConnCount: %d)",
        connection->getPeerAddr().getDisplayStr().c_str(),
        connection->getServerConnCount());

    //string msg = "Welcome to the simple echo server, type 'quit' to exit.\r\n";

	//ConnetManager::instance().add(connection);

    connection->recv(SELF_PACKET_SPLITTER, EMPTY_CONTEXT);
}
开发者ID:mfc10001,项目名称:baoluo,代码行数:15,代码来源:main_server.cpp


注:本文中的TcpConnectionPtr::getServerConnCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。