net_handle_t ClientConn::connect(const string& strIp, uint16_t nPort, const string& strName, const string& strPass) { m_handle = netlib_connect(strIp.c_str(), nPort, imconn_callback, &g_client_conn_map); if(m_handle != NETLIB_INVALID_HANDLE) g_client_conn_map.insert(make_pair(m_handle, this)); return m_handle; }
void FileMsgServerConn::OnConnect(net_handle_t handle) { m_handle = handle; g_file_msg_server_conn_map.insert(make_pair(handle, this)); netlib_option(handle, NETLIB_OPT_SET_CALLBACK, (void*)imconn_callback); netlib_option(handle, NETLIB_OPT_SET_CALLBACK_DATA, (void*)&g_file_msg_server_conn_map); }
void CRouteConn::OnConnect(net_handle_t handle) { m_handle = handle; g_route_conn_map.insert(make_pair(handle, this)); netlib_option(handle, NETLIB_OPT_SET_CALLBACK, (void*)imconn_callback); netlib_option(handle, NETLIB_OPT_SET_CALLBACK_DATA, (void*)&g_route_conn_map); }
void CRouteServConn::Connect(const char* server_ip, uint16_t server_port, uint32_t idx) { log("Connecting to RouteServer %s:%d\n", server_ip, server_port); m_serv_idx = idx; m_handle = netlib_connect(server_ip, server_port, imconn_callback, (void*)&g_route_server_conn_map); if (m_handle != NETLIB_INVALID_HANDLE) { g_route_server_conn_map.insert(make_pair(m_handle, this)); } }
void FileClientConn::OnConnect(net_handle_t handle) { /// yunfan modify 2014.8.7 m_handle = handle; g_file_client_conn_map.insert(make_pair(handle, this)); netlib_option(handle, NETLIB_OPT_SET_CALLBACK, (void*)imconn_callback); netlib_option(handle, NETLIB_OPT_SET_CALLBACK_DATA, (void*)&g_file_client_conn_map); uint32_t socket_buf_size = NETLIB_MAX_SOCKET_BUF_SIZE; netlib_option(handle, NETLIB_OPT_SET_SEND_BUF_SIZE, &socket_buf_size); netlib_option(handle, NETLIB_OPT_SET_RECV_BUF_SIZE, &socket_buf_size); /// yunfan modify end }