• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OnConnect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中OnConnect函数的典型用法代码示例。如果您正苦于以下问题:C++ OnConnect函数的具体用法?C++ OnConnect怎么用?C++ OnConnect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: switch

void CRealControlSocket::OnSocketEvent(wxSocketEvent &event)
{
	if (!m_pBackend)
		return;

	if (event.GetId() != m_pBackend->GetId())
		return;

	switch (event.GetSocketEvent())
	{
	case wxSOCKET_CONNECTION:
		m_onConnectCalled = true;
		OnConnect();
		break;
	case wxSOCKET_INPUT:
		if (!m_onConnectCalled)
		{
			m_onConnectCalled = true;
			OnConnect();
		}
		OnReceive();
		break;
	case wxSOCKET_OUTPUT:
		OnSend();
		break;
	case wxSOCKET_LOST:
		OnClose();
		break;
	}
}
开发者ID:idgaf,项目名称:FileZilla3,代码行数:30,代码来源:ControlSocket.cpp


示例2: disconnect

void QmitkNDIConfigurationWidget::UpdateWidgets()
{
  m_Controls->m_DeviceStatus->setText(this->GetStatusText());
  if (m_Tracker.IsNull())  // not connected to tracker
  {
    m_Controls->m_Connect->setText("Connect");
    m_Controls->m_lConnection->setText("III. Enable connection to  device  ");

    disconnect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnDisconnect()));
    connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
    m_Controls->m_DiscoverToolsBtn->setDisabled(true);
    m_Controls->m_AddToolBtn->setDisabled(true);
    return;
  }

  if (m_Tracker->GetState() == mitk::TrackingDevice::Setup)
  {
    m_Controls->m_Connect->setText("Connect");
    m_Controls->m_lConnection->setText("III. Enable connection to  device  ");
    disconnect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnDisconnect()));
    connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
    m_Controls->m_DiscoverToolsBtn->setDisabled(true);
    m_Controls->m_AddToolBtn->setDisabled(true);
    return;
  }
  if ((m_Tracker->GetState() == mitk::TrackingDevice::Ready) || (m_Tracker->GetState() == mitk::TrackingDevice::Tracking))
  {
    m_Controls->m_Connect->setText("Disconnect");
    m_Controls->m_lConnection->setText("III. Disable connection to  device ");
    disconnect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
    connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnDisconnect()));
    m_Controls->m_DiscoverToolsBtn->setEnabled(true);
    m_Controls->m_AddToolBtn->setEnabled(true);    
  }  
}
开发者ID:david-guerrero,项目名称:MITK,代码行数:35,代码来源:QmitkNDIConfigurationWidget.cpp


示例3: OnCommand

static BOOL OnCommand(PWLAN_INFO psWLanInfo, WPARAM wParam)
{
    BOOL fRet = TRUE;
    INT  nItemSelected;

    nItemSelected = ListView_GetNextItem(psWLanInfo->hwndNetList, -1, LVNI_SELECTED);

    switch(LOWORD(wParam))
    {
    case IDM_WZC_NETWORK_CONNECT:
        OnConnect(psWLanInfo, nItemSelected);
        break;

    case IDS_WZC_ADD_NEW_SETTINGS:
        OnAddNewSetting(psWLanInfo);
        break;

    case IDM_WZC_NETWORK_REMOVE:
        OnRemoveSetting(psWLanInfo, nItemSelected);
        break;

    case IDM_WZC_NETWORK_PROPERTIES:
        OnNetworkProperties(psWLanInfo, nItemSelected);
        break;

    case IDM_WZC_ADVANCED:
        DialogBox(HINST_RESDLL, MAKEINTRESOURCE(IDD_WZC_WLAN_ADVANCED), psWLanInfo->hDlg, WZCWLanAdvancedDlgProc);
        break;

    case IDC_WZC_COMBO_FILTER:
        if (HIWORD(wParam) == CBN_SELENDOK)
        {
            OnChangeNetFilter(psWLanInfo);
        }
        break;

    case IDM_WZC_WIFI_POWERCMD:
        OnChangePowerState(psWLanInfo);
        break;

    case IDOK:
        // Since we're applying any changes when the dialog is deactivated, we
        // don't need to apply here -- we'll get a deactivate right away.
        break;

    default:
        if (LOWORD(wParam) >= IDM_WZC_MENU_EXT_FIRST && LOWORD(wParam) <= IDM_WZC_MENU_EXT_LAST)
        {
            SHInvokeContextMenuCommand(psWLanInfo->hwndNetList,
                                       LOWORD(wParam),
                                       psWLanInfo->hContextExt ? psWLanInfo->hContextExt : psWLanInfo->hSoftKeyExt);
        }
        else
        {
            fRet = FALSE;
        }
    }

    return fRet;
}
开发者ID:NemProjects,项目名称:WLAN,代码行数:60,代码来源:wzcui.cpp


示例4: OnConnect

bool CRedisClient::OnInit(std::string& address, int& port)
{
	m_address = address;
	m_port = port;
	struct timeval timeout = { 1, 500000 }; // 1.5 seconds 首次链接
	return OnConnect(&timeout);
}
开发者ID:ZZMarquis,项目名称:NetServer,代码行数:7,代码来源:CRedisClient.cpp


示例5: switch

bool STNetEngine::WINIO(int timeout)
{
#ifdef WIN32
	STIocp::IO_EVENT e;
	if ( !m_pNetMonitor->WaitEvent( e, timeout ) ) return false;
	switch( e.type )
	{
	case STIocp::timeout :
		break;
	case STIocp::stop :
		return false;
		break;
	case STIocp::connect :
		OnConnect( e.client, false );
		m_pNetMonitor->AddAccept( e.sock );
		break;
	case STIocp::recv :
		OnData( e.sock, e.pData, e.uDataSize );
		break;
	case STIocp::close :
		OnClose( e.sock );
		break;
	case STIocp::send :
		OnSend( e.sock, e.uDataSize );
		break;
	default:
		break;
	}
	return true;
#endif
	return false;
}
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:32,代码来源:STNetEngine.cpp


示例6: assert

void SessionHandler::WatchStream(int socketDescriptor, bool doWatch)
{
    assert((m_fd != 0 && m_fd != socketDescriptor) == false); // only one stream for a socket

    if (doWatch)
    {
        m_tracer.trace0("watching socket %d", socketDescriptor);

        m_fd = socketDescriptor;
        watch_readable(m_fd, true);

        m_readBuffer = new char[m_bufferSize];
        m_writeBuffer = new char[m_bufferSize];
        m_bytesRead = 0;
        m_bytesToWrite = 0;
        OnConnect();
    }
    else if (m_fd != 0)
    {
        m_tracer.trace0("cleaning up");

        watch_readable(m_fd, false);
        watch_writable(m_fd, false);
        delete [] m_readBuffer;
        delete [] m_writeBuffer;
        m_readBuffer = nullptr;
        m_writeBuffer = nullptr;
        m_fd = 0;
        m_nextMessageLength = 0;
    }
}
开发者ID:kzerbe,项目名称:eos_daemon,代码行数:31,代码来源:SessionHandler.cpp


示例7: isChief

HWNewNet::HWNewNet() :
    isChief(false),
    m_game_connected(false),
    netClientState(Disconnected)
{
    m_private_game = false;
    m_nick_registered = false;

    m_roomsListModel = new RoomsListModel(this);

    m_playersModel = new PlayersListModel(this);

    m_lobbyPlayersModel = new QSortFilterProxyModel(this);
    m_lobbyPlayersModel->setSourceModel(m_playersModel);
    m_lobbyPlayersModel->setSortRole(PlayersListModel::SortRole);
    m_lobbyPlayersModel->setDynamicSortFilter(true);
    m_lobbyPlayersModel->sort(0);

    m_roomPlayersModel = new QSortFilterProxyModel(this);
    m_roomPlayersModel->setSourceModel(m_playersModel);
    m_roomPlayersModel->setSortRole(PlayersListModel::SortRole);
    m_roomPlayersModel->setDynamicSortFilter(true);
    m_roomPlayersModel->sort(0);
    m_roomPlayersModel->setFilterRole(PlayersListModel::RoomFilterRole);
    m_roomPlayersModel->setFilterFixedString("true");

    // socket stuff
    connect(&NetSocket, SIGNAL(readyRead()), this, SLOT(ClientRead()));
    connect(&NetSocket, SIGNAL(connected()), this, SLOT(OnConnect()));
    connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect()));
    connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this,
            SLOT(displayError(QAbstractSocket::SocketError)));

    connect(this, SIGNAL(messageProcessed()), this, SLOT(ClientRead()), Qt::QueuedConnection);
}
开发者ID:GhostAlgorithm,项目名称:hw,代码行数:35,代码来源:newnetclient.cpp


示例8: _T

void CTransferSocket::OnAccept(int error)
{
	m_pControlSocket->SetAlive();
	m_pControlSocket->LogMessage(::Debug_Verbose, _T("CTransferSocket::OnAccept(%d)"), error);

	if (!m_pSocketServer)
	{
		m_pControlSocket->LogMessage(::Debug_Warning, _T("No socket server in OnAccept"), error);
		return;
	}

	m_pSocket = m_pSocketServer->Accept(error);
	if (!m_pSocket)
	{
		if (error == EAGAIN)
			m_pControlSocket->LogMessage(::Debug_Verbose, _T("No pending connection"));
		else
		{
			m_pControlSocket->LogMessage(::Status, _("Could not accept connection: %s"), CSocket::GetErrorDescription(error).c_str());
			TransferEnd(transfer_failure);
		}
		return;
	}
	delete m_pSocketServer;
	m_pSocketServer = 0;

	OnConnect();
}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:28,代码来源:transfersocket.cpp


示例9: CNDKServerSocket

// Processes pending accept.
void CNDKServer::ProcessPendingAccept(long lErrorCode)
{
	if (lErrorCode == 0)
	{
		CNDKServerSocket* pSocket = new CNDKServerSocket(this);

		if (pSocket != NULL)
		{
			BOOL bResult = FALSE;

			if (m_pListeningSocket->Accept(*pSocket))
			{
				// Ask to accept the new connection
				if (pSocket->Initialize() && OnIsConnectionAccepted())
				{
					OnConnect(m_userMgr.AddUser(pSocket));
					bResult = TRUE;
				}
			}

			if (!bResult)
				delete pSocket;
		}
	}
}
开发者ID:saladyears,项目名称:Sea3D,代码行数:26,代码来源:NDKServer.cpp


示例10: connect

void CNetworkConnection::initializeSocket()
{
	m_pSocket->disconnect();

	connect(m_pSocket, SIGNAL(connected()),
			this, SIGNAL(connected()));
	connect(m_pSocket, SIGNAL(connected()),
			this, SIGNAL(readyToTransfer()));
	connect(m_pSocket, SIGNAL(readyRead()),
			this, SIGNAL(readyToTransfer()));
	connect(m_pSocket, SIGNAL(disconnected()),
			this, SIGNAL(disconnected()));
	connect(m_pSocket, SIGNAL(error(QAbstractSocket::SocketError)),
			this, SIGNAL(error(QAbstractSocket::SocketError)));
	connect(m_pSocket, SIGNAL(bytesWritten(qint64)),
			this, SIGNAL(bytesWritten(qint64)));
	connect(m_pSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
			this, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
	connect(m_pSocket, SIGNAL(aboutToClose()),
			this, SLOT(OnAboutToClose()));

	connect(this, SIGNAL(connected()), this, SLOT(OnConnect()), Qt::QueuedConnection);
	connect(this, SIGNAL(disconnected()), this, SLOT(OnDisconnect()), Qt::QueuedConnection);
	connect(this, SIGNAL(readyRead()), this, SLOT(OnRead()), Qt::QueuedConnection);
	connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(OnError(QAbstractSocket::SocketError)), Qt::QueuedConnection);
	connect(this, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(OnStateChange(QAbstractSocket::SocketState)), Qt::QueuedConnection);
}
开发者ID:BackupTheBerlios,项目名称:quazaa-svn,代码行数:27,代码来源:networkconnection.cpp


示例11: connect

bool WorldServer::Start(QHostAddress address, quint16 port)
{
    if(!m_server->listen(address, port))
        return false;

    connect(m_server, SIGNAL(newConnection()), this, SLOT(OnConnect()));
    return true;
}
开发者ID:Tamboz,项目名称:WakBox,代码行数:8,代码来源:WorldServer.cpp


示例12: while

void Cube_SocketTCP_Server::run()
{
	while (TRUE)
	{
		OnConnect(Accept());
	}

}
开发者ID:matrixcascade,项目名称:XShell,代码行数:8,代码来源:Cube_SocketTCP.cpp


示例13: connect

void CG2Node::SetupSlots()
{
	connect(this, SIGNAL(connected()), this, SLOT(OnConnect()), Qt::QueuedConnection);
	connect(this, SIGNAL(disconnected()), this, SLOT(OnDisconnect()), Qt::QueuedConnection);
	connect(this, SIGNAL(readyRead()), this, SLOT(OnRead()), Qt::QueuedConnection);
	connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(OnError(QAbstractSocket::SocketError)), Qt::QueuedConnection);
	connect(this, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(OnStateChange(QAbstractSocket::SocketState)), Qt::QueuedConnection);
}
开发者ID:geekt,项目名称:quazaa,代码行数:8,代码来源:g2node.cpp


示例14: connect

void QmitkNDIConfigurationWidget::CreateConnections()
{
  connect(m_Controls->m_Connect, SIGNAL(clicked()), this, SLOT(OnConnect()));
  connect(m_Controls->m_DiscoverToolsBtn, SIGNAL(clicked()), this, SLOT(OnDiscoverTools()));
  connect(m_Controls->m_AddToolBtn, SIGNAL(clicked()), this, SLOT(OnAddPassiveTool()));
  connect(m_Controls->m_DisoverDevicesBtn, SIGNAL(clicked()), this, SLOT(OnDiscoverDevices()));
  connect(m_Controls->m_ToolTable->model(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateTrackerFromToolTable(const QModelIndex &, const QModelIndex &)));
  connect(m_Controls->m_DisoverDevicesBtnInfo, SIGNAL(clicked()), this, SLOT(OnDisoverDevicesBtnInfo()));
}
开发者ID:david-guerrero,项目名称:MITK,代码行数:9,代码来源:QmitkNDIConfigurationWidget.cpp


示例15: csa

HRESULT CMackieControlBase::Connect( IUnknown* pUnk, HWND hwndApp )
{
//	TRACE("CMackieControlBase::Connect()\n");

	// Note: You will probably not need to change this implementation.
	// The wizard has already generated code to obtain all of the ISonarXXX
	// interfaces that are available.

	CCriticalSectionAuto csa( &m_cs );

	HRESULT hr = S_OK;

	releaseSonarInterfaces();
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarMidiOut, (void**)&m_pMidiOut ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarKeyboard, (void**)&m_pKeyboard ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarCommands, (void**)&m_pCommands ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarProject, (void**)&m_pProject ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarMixer, (void**)&m_pMixer ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarTransport, (void**)&m_pTransport ) ))
		return hr;

	if (FAILED(      pUnk->QueryInterface( IID_ISonarIdentity, (void**)&m_pSonarIdentity ) ))
	{
		// Don't worry of this fails, it means it's an old version of SONAR
		TRACE("No ISonarIdentity interface available\n");
		m_pSonarIdentity = NULL; // Just in case

		// In this case, use our internal id generator
		m_dwUniqueId = m_cState.GetNextUniqueId();
	}
	else if ( FAILED ( hr = m_pSonarIdentity->GetUniqueSurfaceId( this, &m_dwUniqueId ) ) )
		return hr;

	if ( FAILED( pUnk->QueryInterface( IID_ISonarMixer2, (void**)&m_pMixer2) ) )
		m_pMixer2 = NULL;
	
	if ( FAILED( pUnk->QueryInterface( IID_ISonarParamMapping, (void**)&m_pParamMapping ) ) )
		m_pParamMapping = NULL;
	
	if ( FAILED( pUnk->QueryInterface( IID_ISonarIdentity2, (void**)&m_pSonarIdentity2 ) ) )
		m_pSonarIdentity2 = NULL;
	else if ( FAILED ( hr = m_pSonarIdentity2->GetSupportedRefreshFlags( &m_dwSupportedRefreshFlags ) ) )
		return hr;

	// Call the child class OnConnect()...
	OnConnect();

	// OK, now we're connected
	m_bConnected = true;

	return hr;
}
开发者ID:AZSlow3,项目名称:Cakewalk-Control-Surface-SDK,代码行数:57,代码来源:MackieControlBaseSurfaceGen.cpp


示例16: OnConnect

void NetworkManager::OnEvent(int numOfEvent, int threadId)
{
	int strLen = 0;
	char buffer[1024];
	for(int i=0; i<numOfEvent; i++)
	{
		int eventFd = m_epollEvent2DList[threadId][i].data.fd;
		if(eventFd == m_serverFd) // when clients attempt to connect
		{
			OnConnect();
		}
		else	// when client request service
		{
			Session* pSession = m_pSessionMap[eventFd];
			strLen = read(eventFd, pSession->buffer, MAX_BUFFER_LENGTH); // Read client request
			if(strLen == 0)	// Client request to disconnect
			{
				epoll_ctl(m_epollFdList[threadId], EPOLL_CTL_DEL, m_epollEvent2DList[threadId][i].data.fd, NULL); // remove client info from epoll instance
				close(eventFd); // disconnecd
				delete pSession;
				m_pSessionMap.erase(eventFd);
				printf("%d session disconnected\n", eventFd);
			}
			else if(strLen < 0)
			{
	/*			if(errno != EWOULDBLOCK && errno != EAGAIN)
				{
					// critical error
					fprintf(stderr, "[ERROR] read() ERROR : %s\n", strerror(errno));
					exit(1);
				}*/
			}
			else
			{
				__uint32_t events = m_epollEvent2DList[threadId][i].events;
				if(events & EPOLLIN)
				{
					OnRead(eventFd, strLen);
				}
				if(events & EPOLLOUT)
				{
					printf("EPOLLOUT\n");
				}
				if(events & EPOLLERR)
				{
					fprintf(stderr, "[ERROR] : EPOLL EVENT ERROR\n");
					exit(-1);				
				}
				//pSession->buffer[strLen] = '\0';
				//printf("%s\n", pSession->buffer);

				// service that someelse
			}
		}
	}
}
开发者ID:rainloader,项目名称:PlaySsenger,代码行数:56,代码来源:NetworkManager.cpp


示例17: csa

HRESULT CACTController::Connect( IUnknown* pUnk, HWND hwndApp )
{
	// Note: You will probably not need to change this implementation.
	// The wizard has already generated code to obtain all of the ISonarXXX
	// interfaces that are available.

	CCriticalSectionAuto csa( &m_cs );

	HRESULT hr = S_OK;

	releaseSonarInterfaces();
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarMidiOut, (void**)&m_pMidiOut ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarKeyboard, (void**)&m_pKeyboard ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarCommands, (void**)&m_pCommands ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarProject, (void**)&m_pProject ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarMixer, (void**)&m_pMixer ) ))
		return hr;
	if (FAILED( hr = pUnk->QueryInterface( IID_ISonarTransport, (void**)&m_pTransport ) ))
		return hr;

	// try to obtain the optional ISonarIdentity Interface from the host
	hr = pUnk->QueryInterface( IID_ISonarIdentity, (void**)&m_pSonarIdentity );
	if ( SUCCEEDED( hr ))
	{
		// Obtain a unique instance ID.  This ID will be the same for this surface each time
		// the host is restarted as long as the same surfaces are active in the host.
		m_dwSurfaceId = 0;
		hr = m_pSonarIdentity->GetUniqueSurfaceId( reinterpret_cast<IControlSurface*>(this), &m_dwSurfaceId );
		if ( FAILED( hr ))
			return hr;
	}

	if (FAILED( pUnk->QueryInterface( IID_ISonarParamMapping, (void**)&m_pSonarParamMapping ) ))
	{
		// Just in case
		m_pSonarParamMapping = NULL;
	}

	if (FAILED( pUnk->QueryInterface( IID_ISonarMixer2, (void**)&m_pSonarMixer2 ) ))
	{
		// Just in case
		m_pSonarMixer2 = NULL;
	}

	// Call the child class OnConnect()...
	OnConnect();

	// OK, now we're connected
	m_bConnected = true;

	return hr;
}
开发者ID:docbradley,项目名称:Cakewalk-Control-Surface-SDK,代码行数:56,代码来源:ACTControllerSurfaceGen.cpp


示例18: switch

void CAsyncSocketExLayer::CallEvent(int nEvent, int nErrorCode)
{
	if (m_nCriticalError)
		return;
	m_nCriticalError=nErrorCode;
	switch (nEvent)
	{
	case FD_READ:
	case FD_FORCEREAD:
		if (GetLayerState()==connected)
		{
			if (nErrorCode)
				SetLayerState(aborted);
			OnReceive(nErrorCode);
		}
		break;
	case FD_WRITE:
		if (GetLayerState()==connected)
		{
			if (nErrorCode)
				SetLayerState(aborted);
			OnSend(nErrorCode);
		}
		break;
	case FD_CONNECT:
		if (GetLayerState()==connecting)
		{
			if (!nErrorCode)
				SetLayerState(connected);
			else
				SetLayerState(aborted);
			OnConnect(nErrorCode);
		}
		break;
	case FD_ACCEPT:
		if (GetLayerState()==listening)
		{
			if (!nErrorCode)
				SetLayerState(connected);
			else
				SetLayerState(aborted);
			OnAccept(nErrorCode);
		}
		break;
	case FD_CLOSE:
		if (GetLayerState()==connected)
		{
			if (nErrorCode)
				SetLayerState(aborted);
			else
				SetLayerState(closed);
			OnClose(nErrorCode);
		}
		break;
	}
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:56,代码来源:AsyncSocketExLayer.cpp


示例19: guard

bool CRedisClient::ReConnect()
{
	LockerGuard guard(*m_locker);
	if( m_pRedisContext )
	{
		redisFree(m_pRedisContext);
		m_pRedisContext = NULL;
	}
	struct timeval timeout = { 0, 500000 }; // 0.5 seconds 重连
	return OnConnect(&timeout);
}
开发者ID:ZZMarquis,项目名称:NetServer,代码行数:11,代码来源:CRedisClient.cpp


示例20: WSAGETASYNCERROR

/*========================================================================================
	FUNCTION: LBaseSock::WindowProc()
	DESCRIPT: Event handler window procedure.
	RETURN	:
	ARGUMENT:
		uMsg  : (i)Message ID
		wParam: (i)Message parameter 1
		lParam: (i)Message parameter 2
	UPDATE	: 2004/07/01, In-hyeok Paek; First work!
========================================================================================*/
LRESULT LBaseSock::WindowProc( UINT uMsg, WPARAM wParam, LPARAM lParam ) 
{
	int		nErr;	//	Socket error code
	
	if( uMsg == WM_SOCK_SOCKET ) {
		nErr =  WSAGETASYNCERROR( lParam );
		switch( WSAGETSELECTEVENT( lParam ) ) {
			case FD_ACCEPT:
				OnAccept( nErr );
				break;
			case FD_CONNECT: 
				::KillTimer( m_hWnd, IDT_SOCK_CONNECT );
				OnConnect( nErr ); 
				break;
			case FD_CLOSE:
				OnClose( nErr );
				break;
			case FD_READ:
				OnReceive( nErr );
				break;
			case FD_WRITE:
				OnSend( nErr );
				break;
		}
		return 0L;
	}
	else if( uMsg == WM_TIMER ) {
		if( wParam == IDT_SOCK_CONNECT ) {
			if( m_Sock != INVALID_SOCKET ) {
				closesocket( m_Sock );
				m_Sock = INVALID_SOCKET;
			}
			m_nLastErr = WSAETIMEDOUT;
			OnConnect( WSAETIMEDOUT );
			return 0L;
		}
		
	}

	return ::DefWindowProc( m_hWnd, uMsg, wParam, lParam );
}
开发者ID:japgo,项目名称:mygithub,代码行数:51,代码来源:LBaseSock.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OnCreate函数代码示例发布时间:2022-05-30
下一篇:
C++ OnCommand函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap