本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
}
示例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());
}
示例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;
}
}
示例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());
}
示例7: onConnected
void onConnected(TcpSessionPtr session)
{
LOGI("onConnected. ConnectorID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort() );
SendFunc(session, g_sendType != 0);
};
示例8: OnSessionDisconnect
void OnSessionDisconnect(TcpSessionPtr session)
{
LOGI("OnSessionDisconnect. sID=" << session->getSessionID() << ", remoteIP=" << session->getRemoteIP() << ", remotePort=" << session->getRemotePort());
}