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


C++ OnConnect函数代码示例

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


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


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