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


C++ TcpSessionPtr::getRemotePort方法代码示例

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


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

示例1: _onSessionLinked

static void _onSessionLinked(lua_State * L, TcpSessionPtr session)
{
    lua_pushcfunction(L, pcall_error);
    lua_rawgeti(L, LUA_REGISTRYINDEX, _linkedRef);
    lua_pushnumber(L, session->getSessionID());
    lua_pushstring(L, session->getRemoteIP().c_str());
    lua_pushnumber(L, session->getRemotePort());
    int status = lua_pcall(L, 3, 0, 1);
    lua_remove(L, 1);
    if (status)
    {
        const char *msg = lua_tostring(L, -1);
        if (msg == NULL) msg = "(error object is not a string)";
        LOGE(msg);
        lua_pop(L, 1);
    }
}
开发者ID:ZhuOS,项目名称:breeze,代码行数:17,代码来源:summer.cpp

示例2: _onSessionClosed

static void _onSessionClosed(lua_State * L, TcpSessionPtr session)
{
    if (_closedRef == LUA_NOREF)
    {
        LOGW("_onSessionClosed warning: cannot found ther callback.");
        return;
    }
    lua_pushcfunction(L, pcall_error);
    lua_rawgeti(L, LUA_REGISTRYINDEX, _closedRef);
    lua_pushnumber(L, session->getSessionID());
    lua_pushstring(L, session->getRemoteIP().c_str());
    lua_pushnumber(L, session->getRemotePort());
    int status = lua_pcall(L, 3, 0, 1);
    lua_remove(L, 1);
    if (status)
    {
        const char *msg = lua_tostring(L, -1);
        if (msg == NULL) msg = "(error object is not a string)";
        LOGE(msg);
        lua_pop(L, 1);
    }
}
开发者ID:ZhuOS,项目名称:breeze,代码行数:22,代码来源:summer.cpp

示例3: event_onSessionDisconnect

void NetManager::event_onSessionDisconnect(TcpSessionPtr session)
{
	LOGT("NetManager::event_onSessionDisconnect. SessionID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());

	if (isConnectID(session->getSessionID()))
	{
	}
	else
	{
		if (session->getUserParam() == SS_LOGINED)
		{
			auto info = UserManager::getRef().getInnerUserInfoBySID(session->getSessionID());
			if (info)
			{
				UserManager::getRef().userLogout(info);
				info->sID = InvalidSeesionID;
			}
		}

	}

	if (UserManager::getRef().getAllOnlineUserCount() == 0 && _onSafeClosed)
	{
		SessionManager::getRef().post(_onSafeClosed);
		_onSafeClosed = nullptr;
	}
}
开发者ID:heber,项目名称:breeze,代码行数:27,代码来源:netManager.cpp

示例4: event_onSessionEstablished

void NetManager::event_onSessionEstablished(TcpSessionPtr session)
{
	session->setUserLParam(SS_UNLOGIN);
	LOGT("NetManager::event_onSessionEstablished. SessionID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());
}
开发者ID:heber,项目名称:breeze,代码行数:5,代码来源:netManager.cpp

示例5: event_onClosed

void NetMgr::event_onClosed(TcpSessionPtr session)
{
    LOGD("NetMgr::event_onClosed. SessionID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());

    if (isConnectID(session->getSessionID()))
    {
    }
    else
    {
        if (session->getUserParamNumber(UPARAM_SESSION_STATUS) == SSTATUS_LOGINED)
        {
            auto founder = _mapUserInfo.find(session->getUserParamNumber(UPARAM_USER_ID));
            if (founder == _mapUserInfo.end() || founder->second->sID != session->getSessionID())
            {
                _mapSession.erase(session->getSessionID());
                return;
            }
            
            event_onLogout(founder->second);
            founder->second->sID = InvalidSessionID;
        }
        _mapSession.erase(session->getSessionID());
    }

    if (_mapSession.size() == 0 && _onSafeClosed)
    {
        SessionManager::getRef().post(_onSafeClosed);
        _onSafeClosed = nullptr;
    }
}
开发者ID:roger912,项目名称:breeze,代码行数:30,代码来源:netMgr.cpp

示例6: event_onLinked

void NetMgr::event_onLinked(TcpSessionPtr session)
{
    session->setUserParam(UPARAM_SESSION_STATUS, SSTATUS_UNKNOW);
    LOGD("NetMgr::event_onLinked. SessionID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());
}
开发者ID:roger912,项目名称:breeze,代码行数:5,代码来源:netMgr.cpp

示例7: onConnected

 void onConnected(TcpSessionPtr session)
 {
     LOGI("onConnected. ConnectorID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort() );
     SendFunc(session, g_sendType != 0);
 };
开发者ID:jimmy486,项目名称:zsummerX,代码行数:5,代码来源:FrameStressMain.cpp

示例8: OnSessionDisconnect

 void OnSessionDisconnect(TcpSessionPtr session)
 {
     LOGI("OnSessionDisconnect. sID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());
 }
开发者ID:jimmy486,项目名称:zsummerX,代码行数:4,代码来源:FrameStressMain.cpp


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