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

C++ OnReceive函数代码示例

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

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



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

示例1: _wtoi

void debugmodel::OnBnClickedButton4()
{
	// TODO:  获取状态
	char data[] = "1234567";

	data[0] = ADDFIRST;
	data[2] = ADDEND;

	CString tmp;
	m_garage_id.GetWindowText(tmp);

	if (tmp == "")
		return;

	data[1] = _wtoi(tmp.GetBuffer(0));
	data[3] = GETSTATE;
	//m_row.GetWindowText(tmp);
	data[4] = 0;// _wtoi(tmp.GetBuffer(0));
	//m_col.GetWindowText(tmp);
	data[5] = 0;// _wtoi(tmp.GetBuffer(0));

	data[6] = (data[1] + data[3] + data[4] + data[5]) % CHECKMOD;

	TESTPUTSEND

	OnSend(data, 7);
	Sleep(100);
	memset(recstr, '\0', COMLEN);
	OnReceive(recstr, 4);

	TESTPUTRECN
	//putinfo(recstr);

	switch (recstr[1])
	{
	case STATEFREE:
		m_state.SetWindowTextW(_T("空闲"));
		break;
	case STATESAVE:
		m_state.SetWindowTextW(_T("存车"));
		break;
	case STATEDELETE:
		m_state.SetWindowTextW(_T("取车"));
		break;
	case STATESTOP:
		m_state.SetWindowTextW(_T("停止"));
		break;
	case STATERSET:
		m_state.SetWindowTextW(_T("复位"));
		break;
	case ACCEPTED:
		m_state.SetWindowTextW(_T("已接收"));
		break;
	case BUSY:
		m_state.SetWindowTextW(_T("运行中"));
		break;
	default:
		m_state.SetWindowTextW(_T("未知"));
	}
}
开发者ID:707wk,项目名称:mechanical_parking_system,代码行数:60,代码来源:debugmodel.cpp


示例2: 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


示例3: ContinueToReceiveSocketData

void hublistcollector::OnReceive(int error_code)
{
	//error checking
	if(error_code!=0)
	{
		p_dlg->StatusUpdate("Error Receiving Data");
	}

	if(m_receiving_socket_data || m_receiving_some_socket_data)
	{
		ContinueToReceiveSocketData();
		return;
	}

	ReceiveSomeSocketData(1516);

	char buf[1];
	memset(buf,0,sizeof(buf));
	WSABUF wsabuf;
	wsabuf.buf=buf;
	wsabuf.len=1;

	DWORD num_read=0;
	DWORD flags=MSG_PEEK;
	int ret=WSARecv(m_hSocket,&wsabuf,1,&num_read,&flags,NULL,NULL);

	if(ret!=SOCKET_ERROR)
	{
		if(num_read!=0)
		{
			OnReceive(0);	// recursive call
		}
	}
}
开发者ID:vdrive,项目名称:TrapperKeeper,代码行数:34,代码来源:HubListCollector.cpp


示例4: main

int main()
{
  {
    //The Qt way
    QtEmitter e;
    QtReceiver r;
    QObject::connect(&e,SIGNAL(signal_emit()),&r,SLOT(OnReceive()));
    e.DoEmit();
  }
  {
    //The Boost way

    //Create the emitter and receiver
    Emitter e;
    Receiver r;

    //The emitter is not yet connected to a receiver/slot
    assert(e.m_signal.num_slots() == 0);

    //Connect the emitter to a receiver/slot
    e.m_signal.connect(
      boost::bind(
        &Receiver::OnReceive,r //Don't forget to put placeholders here (e.g. _1 ) if the signal have additional arguments
      )
    );

    //The emitter is now connected to a receiver/slot
    assert(e.m_signal.num_slots() == 1);

    //Make the magic happen: the emitter puts out a signal and -unknown to it- the receiver responds
    e.DoEmit();
  }
  assert(1==2);
}
开发者ID:richelbilderbeek,项目名称:CppTests,代码行数:34,代码来源:main.cpp


示例5: OnDisconnect

void Session::handle_receive( const boost::system::error_code& error, size_t bytes_transferred )
{
    if( error )
    {
        if( error == boost::asio::error::eof )
        {
            std::cout << "클라이언트와 연결이 끊어졌습니다" << std::endl;
        }
        else
        {
            std::cout << "error No: " << error.value() << " error Message: " << error.message() << std::endl;
        }

        _SessionDesc desc;
        desc.sessionType = 0;
        desc.identifier = 1;

        m_pServer->CloseSession( m_nSessionID );
        OnDisconnect(m_nSessionID, desc);
    }
    else
    {
        _SessionDesc desc;
        desc.sessionType = 0;
        desc.identifier = 1;

        if (false == OnReceive(m_ReceiveBuffer.data(), bytes_transferred, desc))
        {
            //강제로 끊게 하는 메소드는?
        }

        PostReceive();
    }
}
开发者ID:BornHunter,项目名称:CGSF,代码行数:34,代码来源:ServerSession.cpp


示例6: NetClientPoll

void NetClientPoll(NetClient *n)
{
	if (!n->client || !n->peer)
	{
		return;
	}
	// Service the connection
	int check;
	do
	{
		ENetEvent event;
		check = enet_host_service(n->client, &event, 0);
		if (check < 0)
		{
			printf("Connection error %d\n", check);
			return;
		}
		else if (check > 0)
		{
			switch (event.type)
			{
			case ENET_EVENT_TYPE_RECEIVE:
				OnReceive(n, event);
				break;
			default:
				printf("Unexpected event type %d\n", event.type);
				break;
			}
		}
	} while (check > 0);
}
开发者ID:depoorterp,项目名称:cdogs-sdl,代码行数:31,代码来源:net_client.c


示例7: HIWORD

/**
 * Application must call this if a WM_ is coming from network.
 */
HRESULT ACWinSock::MsgProc(WPARAM wp, LPARAM lp) 
{
	WORD  wEvent, wError;
   
	// get data
	wError = HIWORD(lp);
	wEvent = LOWORD(lp);
   
	// which event
	switch (wEvent) 
	{
		// confirmacao depois de uma conexao bem sucedida
		case FD_CONNECT: break;
         
		// cliente quer aceitacao
		case FD_ACCEPT:  { return OnAccept(); } break;
         
		// recebemos algo
		case FD_READ:    { return OnReceive(wp); } break;
         
		// um cliente ficou offline
		case FD_CLOSE:   { return OnDisconnect(wp); } break;
         
		// nos mandamos algo?
		case FD_WRITE:   break;
	}

	return AC_OK;
};
开发者ID:dgadens,项目名称:ActionEngine,代码行数:32,代码来源:ACWinSock.cpp


示例8: HIWORD

// NOTE: Since the old WSAAsync functionality has been exchanged in the favor of WSAEvent, I'm not sure if MsgProc will fire correctly
HRESULT ZFXWS::MsgProc( WPARAM wp, LPARAM lp )
{
   WORD  wEvent, wError;

   wError = HIWORD(lp);
   wEvent = LOWORD(lp);

   //evaluate what event occurred
   switch ( wEvent )
   {
      //new client accepted
      case FD_CONNECT:
         break;
      
      //new client is knocking
      case FD_ACCEPT:
         return OnAccept();
         break;

      //there is data to be received
      case FD_READ:
         return OnReceive(wp);
         break;

      //a socket is closing
      case FD_CLOSE:
         return OnDisconnect(wp);
         break;

      //after sending data
      case FD_WRITE:
         break;
   }
   return ZFX_OK;
}
开发者ID:CodeRedd,项目名称:zfx-engine-zerbst-duvel,代码行数:36,代码来源:ZFXWS.cpp


示例9: Close

void CExternalIpCheck::OnConnect(int nErrorCode)
{
	if (!m_bActive)
		return;

	if (nErrorCode)
	{
		m_bActive = FALSE;
		Close();
		m_nRetryCount++;
		return;
	}

	CStdStringA address = "GET " + m_pOwner->m_pOptions->GetOption(OPTION_CUSTOMPASVIPSERVER) + " HTTP/1.0\r\nUser-Agent: FileZilla Server\r\n\r\n";
	const char *buffer = address;
	int len = strlen(buffer);
	if (Send(buffer, len) != len)
	{
		m_bActive = FALSE;
		Close();
		m_nRetryCount++;
	}

	OnReceive(0);
}
开发者ID:wy182000,项目名称:filezilla-filezillserver-vs2013,代码行数:25,代码来源:ExternalIpCheck.cpp


示例10: while

void CExternalIPResolver::OnSend()
{
	while (m_pSendBuffer)
	{
		unsigned int len = strlen(m_pSendBuffer + m_sendBufferPos);
		int error;
		int written = m_pSocket->Write(m_pSendBuffer + m_sendBufferPos, len, error);
		if (written == -1)
		{
			if (error != EAGAIN)
				Close(false);
			return;
		}

		if (!written)
		{
			Close(false);
			return;
		}

		if (written == (int)len)
		{
			delete [] m_pSendBuffer;
			m_pSendBuffer = 0;

			OnReceive();
		}
		else
			m_sendBufferPos += written;
	}
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:31,代码来源:externalipresolver.cpp


示例11: QObject

Client::Client(QObject *parent) : QObject(parent)
{
    socket = new QTcpSocket(this);
    connect(this->socket, SIGNAL(readyRead()),this, SLOT(OnReceive()));
    m_hostmessref=0;

}
开发者ID:ticano,项目名称:SDS,代码行数:7,代码来源:client.cpp


示例12: LOG

void L2Socket::HandleAccept( tcp::socket& _socket, boost::system::error_code _ec )
{
    if (!acceptor->is_open() )
    {
        LOG( "HandleAccept acceptor !is_open()!!!" );
        return ;
    }
    if( _ec )
    {
        LOG( "HandleAccept error: "+ _ec.message() );
        Disconnect(_socket);
        return;
    }
    LOG( "HandleAccept New Connect ip: "+_socket.remote_endpoint().address().to_string() + " port: " + _socket.remote_endpoint().port());
    
    //tcp::no_delay option(true);
    //_socket.set_option(option);

    shared_ptr<L2Actor> _act = L2_GET_UNUSED_OBJ(L2Actor);
    
    SERVER->PushActor( _act->OID );
    
    _act->GetAgent()->SetConnect(true);
    sockAry.push_back(&_socket);
    agentOIDAry.push_back( _act->GetAgent()->OID );
    
    if( bWebSocket )
        OnHandshake(_socket,_act->GetAgent()->OID);
    else
        OnReceive( _socket,_act->GetAgent()->OID );
    
    //THREAD->ThreadSleepFPS();
    OnAccept();
}
开发者ID:LockeLin,项目名称:WebSocket_server,代码行数:34,代码来源:socket.cpp


示例13: switch

HRESULT CClientWizard::DirectPlayMessageHandler(PVOID pvUserContext, DWORD dwMessageID, PVOID pMsgBuffer)
{
	HRESULT hr = S_OK;
	switch(dwMessageID)
	{
	case DPN_MSGID_ASYNC_OP_COMPLETE:
		hr = OnAsyncOpComplete(pMsgBuffer);
		break;
	case DPN_MSGID_CONNECT_COMPLETE:
		hr = OnConnectComplete(pMsgBuffer);
		break;
	case DPN_MSGID_ENUM_HOSTS_RESPONSE:
		hr = OnHostsResponse(pMsgBuffer);
		break;
	case DPN_MSGID_TERMINATE_SESSION:
	//	hr = OnTerminateSession(pMsgBuffer);
		break;
	case DPN_MSGID_RECEIVE:
		OnReceive(pMsgBuffer);
		break;
	default:
		break;
	}

	return hr;
}
开发者ID:RaoMiao,项目名称:freestyle,代码行数:26,代码来源:ClientWizard.cpp


示例14: ASSERT

void CEC_LogicalDevice::OnReceiveComplete(unsigned char* buffer, int count)
{
	ASSERT(count >= 1);
	int sourceAddress = (buffer[0] >> 4) & 0x0f;
	int targetAddress = buffer[0] & 0x0f;
	OnReceive(sourceAddress, targetAddress, buffer + 1, count - 1);
}
开发者ID:thiakil,项目名称:CecArduinoTV,代码行数:7,代码来源:CEC_LogicalDevice.cpp


示例15: ContinueToReceiveSocketData

void DCDownload::OnReceive(int error_code)
{
	if(error_code!=0)
	{
		return;	//return due to error
	}

	if(m_receiving_socket_data || m_receiving_some_socket_data)
	{
		ContinueToReceiveSocketData();
		return;
	}

	ReceiveSomeSocketData(1516);

	char buf[1];
	memset(buf,0,sizeof(buf));
	WSABUF wsabuf;
	wsabuf.buf=buf;
	wsabuf.len=1;

	DWORD num_read=0;
	DWORD flags=MSG_PEEK;
	int ret=WSARecv(m_hSocket,&wsabuf,1,&num_read,&flags,NULL,NULL);

	if(ret!=SOCKET_ERROR)
	{
		if(num_read!=0)
		{
			OnReceive(0);	// recursive call
		}
	}
	//::AfxMessageBox("Received Message");
}
开发者ID:vdrive,项目名称:TrapperKeeper,代码行数:34,代码来源:DCDownload.cpp


示例16: OnReceive

void CEMSocket::DisableDownloadLimit(){
	downloadLimitEnable = false;

	// CPU load improvement
	if(pendingOnReceive == true){
		OnReceive(0);
	}
}
开发者ID:HackLinux,项目名称:eMule-Mirror,代码行数:8,代码来源:EMSocket.cpp


示例17: OnTransmit

//--------------------------------
void esp8266::OnUart(uint32_t ui32Ints) {
	if (ui32Ints & UART_INT_TX) {
		OnTransmit();
	}
	if (ui32Ints & (UART_INT_RX | UART_INT_RT)) {
		OnReceive();
	}
}
开发者ID:anol,项目名称:justscale,代码行数:9,代码来源:esp8266.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: OnReceive

void CTransferSocket::OnIOThreadEvent(CIOThreadEvent& event)
{
	if (!m_bActive || m_transferEndReason != none)
		return;

	if (m_transferMode == download)
		OnReceive();
	else if (m_transferMode == upload)
		OnSend();
}
开发者ID:Hellcenturion,项目名称:MILF,代码行数:10,代码来源:transfersocket.cpp


示例20: switch

void CRS232::ProcessMsgComEvent(DWORD eventid)
{
	switch(eventid)
	{
	case COM_EVT_RECV:
		OnReceive();
		break;
	}
	CCom::ProcessMsgComEvent(eventid);
}
开发者ID:lilingshui,项目名称:PSM,代码行数:10,代码来源:RS232.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ OnRender函数代码示例发布时间:2022-05-30
下一篇:
C++ OnPrepareDC函数代码示例发布时间: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