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

C++ ReceiveData函数代码示例

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

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



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

示例1: ClientTask

	dword ClientTask()
	{
		CScopedLock _lock;
		CTcpClient* pClient = NULL;
		CDataDoubleLinkedListT<CTcpClient>::Iterator it = _tcpclients.Begin();
				
		if ( it && (*it) )
		{
			pClient = *it;
			_tcpclients.Remove(it, EmptyDeleteFunc, NULL);
		}
		if ( !pClient )
			return 0;

		CStringBuffer sBuffer;

		wcout(_T("ClientTask"));
		try
		{
			CStringConstIterator itB;
			bool bExit = false;

			_lock.unlock();
			ReceiveData(pClient, sBuffer);
			wcout(sBuffer.GetString());
			SendData(pClient, sBuffer);

			ReceiveData(pClient, sBuffer);
			wcout(sBuffer.GetString());
			SendData(pClient, sBuffer);

			ReceiveData(pClient, sBuffer);
			wcout(sBuffer.GetString());
			SendData(pClient, sBuffer);

			ReceiveData(pClient, sBuffer);
			wcout(sBuffer.GetString());
			SendData(pClient, sBuffer);

			ReceiveData(pClient, sBuffer);
			itB = sBuffer;
			itB.Find(_T("STOP\r\n"));
			if ( itB.IsBegin() )
				bExit = true;
			wcout(sBuffer.GetString());
			SendData(pClient, sBuffer);

			pClient->CloseConnection();
			_lock.lock();
			pClient->release();
			_bExit = bExit;
		}
		catch ( CTcpClientException* ex )
		{
			COUT << ex->GetExceptionMessage() << endl;
			pClient->CloseConnection();
		}
		return 0;
	}
开发者ID:okdevdo,项目名称:UserLib,代码行数:59,代码来源:Program9.cpp


示例2: Send_Command

static int Send_Command(unsigned char *DataBuffer, unsigned int Size)
{
    int Temp;

    Temp = -1;
    while(Temp == -1)
    {
        Temp = Send_Packet(DataBuffer, Size);
    }

    Temp = -1;
    while(Temp == -1)
    {
        Temp = Send_Packet(command_get_status, 1);
    }

    //Temp = 0;
    ReceiveData((unsigned char *)&Temp, 1);

    if(Temp != COMMAND_RET_SUCCESS)
    {
        return -1;
    }

    // This command is executed successfully
    return 0;
}
开发者ID:yixinshark,项目名称:ZyzBq,代码行数:27,代码来源:m4_update.c


示例3: seconds

void CSocketEngine::GetData(){
  if(iCount==1){//如果是接收文件的第一个数据包
    if(!GetFirstData()) return;
  }
  if(0==iSpeed){//网速未知
    if(2==iCount){
      iTimeTestSpeed1.HomeTime();
      iSizeTestSpeed1=iData1.Length();
      iSizeTestSpeed2=iSizeTestSpeed1;
    }
    if(iCount>2){
      iSizeTestSpeed2+=iData1.Length();
      if((iSizeTestSpeed2-iSizeTestSpeed1)>iTestSpeedSize){
        iTimeTestSpeed2.HomeTime();
        TTimeIntervalSeconds seconds(0);
        TInt err=iTimeTestSpeed2.SecondsFrom(iTimeTestSpeed1,seconds);
        if(!err){
          TInt sec=seconds.Int();
          iSpeed=(sec>0)?((iSizeTestSpeed2-iSizeTestSpeed1)/sec):KMaxNetSpeed;
          OnHttpSktEvent(EHttpSktEvtSpeedKnown);
        }
      }
    }
  }
  if(bSearch){
    if(iCount==1){
      iData->Des().Zero();
      iReceivedLen=0;
    }
    TBool needSaveFile=this->iDownloadFilePath.Length()>0;
    if(!needSaveFile){
      TInt n=iData->Des().Length()+iData1.Length();
      TInt m=iData->Des().MaxLength();
      if(n<m) iData->Des().Append(iData1);
    }
    iReceivedLen+=iData1.Length();
    if((iReceivedLen-iHttpHeadOverPos)<iTotalLen){
      if(needSaveFile) this->SaveToFile(iData1);
      ReceiveData();
    }else{
      if(iTimer->IsActive()) iTimer->Cancel();
      if(needSaveFile){
        this->SaveToFile(iData1);
        if(iObserver) iObserver->OnDownloadFinished(this->iDownloadFilePath);
      }else if(iObserver){
        int iLen=iData->Length()-iHttpHeadOverPos;
        if(iLen<=0){
          iObserver->OnResponseReceived(_L8(""));
        }else{
          iObserver->OnResponseReceived(iData->Mid(iHttpHeadOverPos,iLen));
        }
      }
      iDownloading=EFalse;
      Cancel();
      iSocket.Close();
    }
  }else{
    if(iObserver) iObserver->OnResponseReceived(iData1);
  }
}
开发者ID:rusteer,项目名称:symbian,代码行数:60,代码来源:SocketEngine.cpp


示例4: switch

int iNet::TcpSocket::Impl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTcpSocket::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: SendDataSignal((*reinterpret_cast< QByteArray(*)>(_a[1]))); break;
        case 1: ConnectToHostSignal((*reinterpret_cast< Utils::HostInf(*)>(_a[1]))); break;
        case 2: DisconnectFromHostSignal(); break;
        case 3: DeleteSignal((*reinterpret_cast< boost::shared_ptr<Utils::ThreadSyncEvent>(*)>(_a[1]))); break;
        case 4: ConnectToHostSlot((*reinterpret_cast< const Utils::HostInf(*)>(_a[1]))); break;
        case 5: ConnectedSlot(); break;
        case 6: SendDataSlot((*reinterpret_cast< const QByteArray(*)>(_a[1]))); break;
        case 7: ReceiveData(); break;
        case 8: DisconnectFromHostSlot(); break;
        case 9: DisconnectedSlot(); break;
        case 10: SocketErrorOccur((*reinterpret_cast< QAbstractSocket::SocketError(*)>(_a[1]))); break;
        case 11: DeleteSlot((*reinterpret_cast< boost::shared_ptr<Utils::ThreadSyncEvent>(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 12;
    }
    return _id;
}
开发者ID:ixc-software,项目名称:lucksi,代码行数:25,代码来源:moc_TcpSocketImpl.cpp


示例5: switch

/**
  Process asynchronous requests.
*/
TInt DZeroCopyLoopbackChannel::DoRequest(TInt aReqNo, TRequestStatus* aStatus, TAny* a1, TAny* a2)
	{
	(void)a2;   // a2 not used in this example

	TInt r;

	switch(aReqNo)
		{
		case RZeroCopyLoopbackDriver::ESendData_ByZeroCopy:
			r = SendData(aStatus, (TInt)a1);
			break;

		case RZeroCopyLoopbackDriver::EReceiveData_ByZeroCopy:
			// Example Platform Security capability check which tests the
			// client for ECapability_None (which always passes)...
			if(iClient->HasCapability(ECapability_None,__PLATSEC_DIAGNOSTIC_STRING("Checked by zerocopy loopback")))
				r = ReceiveData(aStatus, (TInt*)a1);
			else
				r = KErrPermissionDenied;
			break;

		default:
			r = KErrNotSupported;
			break;
		}

	return r;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:31,代码来源:ldd.cpp


示例6: Render

BOOL ClientEngine::Render()
{
	if(m_ConnectState == Not_Connect)
	{
		return FALSE;
	}

	if(m_ConnectState == Start_Connect)
	{
		return FALSE;
	}

	if(m_ConnectState == Raw_Connect)
	{

	}

	if(ReceiveData())
	{
		ProcessData();
	}

	return TRUE;

}
开发者ID:rastline,项目名称:GameProject,代码行数:25,代码来源:ClientEngine.cpp


示例7: setup_ipc

static void
setup_ipc(void)
{
   int k, port = 10001;

   if (MyID == 0) {
      /* I'm the first one, wait for connection from second */
      k = CreatePort(&port);
      assert(k != -1);

      printf("Waiting for connection from another 'corender'\n");
      Sock = AcceptConnection(k);
      assert(Sock != -1);

      printf("Got connection, sending windowID\n");

      /* send windowID */
      SendData(Sock, &WindowID, sizeof(WindowID));
   }
   else {
      /* I'm the second one, connect to first */
      char hostname[1000];

      MyHostName(hostname, 1000);
      Sock = Connect(hostname, port);
      assert(Sock != -1);

      /* get windowID */
      ReceiveData(Sock, &WindowID, sizeof(WindowID));
      printf("Contacted first 'corender', getting WindowID\n");
   }
}
开发者ID:emcmanus,项目名称:FlashMesa3D,代码行数:32,代码来源:corender.c


示例8: Wait

/*
 * Manual page at process.def
 */
INT16 CGEN_PUBLIC CProcess::Wait()
{
  const SMic* pMic    = NULL;                                                   // Method invocation context of Wait()
  CFunction*  iCaller = NULL;                                                   // Function instance calling Wait()

  // Validate and initialize                                                    // ------------------------------------
  if (!((m_nState & PRC_RUNNING)|PRC_COMPLETE))                                 // Not running
    return IERROR(this,PRC_CANTWAIT,"not started",0,0);                         //   Forget it
  if (!(pMic = CDlpObject_MicGet(_this))) return -1;                            // Get method invocation context
  iCaller = (CFunction*)CDlpObject_OfKind("function",pMic->iCaller);            // Get calling CFunction
  if (!iCaller) return -1;                                                      // Must be a function!

  // Wait for job to be completed                                               // ------------------------------------
#ifdef USE_FORK
  if(!m_hThread && m_hPid){                                                     // If there is a child process by fork >>
    waitpid(m_hPid,NULL,0);                                                     //   Wait for child process
    m_nState &= ~PRC_RUNNING;                                                   //   Clear running flag
    m_nState |= PRC_COMPLETE;                                                   //   Set completed flag
  }else                                                                         // <<
#endif
  dlp_join_thread(m_hThread);                                                   // Wait for the watcher thread to end
  ReceiveData();                                                                // Receive transfer data

  // Aftermath                                                                  // ------------------------------------
  if (m_iDto)                                                                   // This job was a function call
    Unmarshal(m_iDto,iCaller);                                                  //   Unmarshal transfer data to caller
  else                                                                          // This job was a program call
    MIC_PUT_N(m_nRetVal);                                                       //   Push process return value

  return O_K;                                                                   // Ok
}
开发者ID:gitgun,项目名称:dLabPro,代码行数:34,代码来源:prc_impl.cpp


示例9: Send_Packet

static int Send_Packet(unsigned char * DataBuffer, unsigned int Size)
{
    unsigned int Temp;

    //caculated the checksum to be sent out with the data
    Temp = CheckSum(DataBuffer, Size);
    
    //Need to include the size (1 byte) and checksum (1 byte) in the packet
    Size += 2;

    // Send out the size , checkres followed by the Data

    SendData((unsigned char *)&Size, 1);
    SendData((unsigned char *)&Temp, 1);
    SendData(DataBuffer, Size - 2);

    //wait for a non-zero byte 
    Temp = 0;
    while(Temp == 0)
    {
        ReceiveData((unsigned char *)&Temp, 1);
    }

    // Check if the byte was a valid ACK and Return -1 if it is not ACK

    if(Temp != COMMAND_ACK)
    {
        return -1;
    }

    //This packet is sent out and received successfully by the M4 bootloader
    return 0;

}
开发者ID:yixinshark,项目名称:ZyzBq,代码行数:34,代码来源:m4_update.c


示例10: ReceiveMsg

int32_t ReceiveMsg(int socket, char **buffer){
    int32_t data_size=0;
    //Read incoming data size
    if(ReceiveData(socket,(void *)&data_size,sizeof(data_size))==-1){
        close(socket);
        return -1;
    }    
    data_size=ntohl(data_size);
    *buffer=new char[data_size];

    if(ReceiveData(socket,(void *)(*buffer),data_size)==-1){
        close(socket);
        return -1;
    }
    
    return data_size;
}
开发者ID:3Gorec,项目名称:rssi_sniffer,代码行数:17,代码来源:server.cpp


示例11: connect

HttpHandler::HttpHandler(QTcpSocket * s, bool api, bool violetapi):pluginManager(PluginManager::Instance())
{
	incomingHttpSocket = s;
	httpApi = api;
	httpVioletApi = violetapi;
	bytesToReceive = 0;
	connect(s, SIGNAL(readyRead()), this, SLOT(ReceiveData()));
}
开发者ID:1git,项目名称:OpenJabNab,代码行数:8,代码来源:httphandler.cpp


示例12: while

uint8_t i2c_t::CmdWriteRead(uint8_t Addr,
        uint8_t *WPtr, uint8_t WLength,
        uint8_t *RPtr, uint8_t RLength) {
    if(IBusyWait() != OK) return FAILURE;
    // Clear flags
    ii2c->SR1 = 0;
    while(RxIsNotEmpty()) (void)ii2c->DR;   // Read DR until it empty
    ClearAddrFlag();
    // Start transmission
    SendStart();
    if(WaitEv5() != OK) return FAILURE;
    SendAddrWithWrite(Addr);
    if(WaitEv6() != OK) { SendStop(); return FAILURE; }
    // Start TX DMA if needed
    if(WLength != 0) {
        if(WaitEv8() != OK) return FAILURE;
        dmaStreamSetMemory0(PDmaTx, WPtr);
        dmaStreamSetTransactionSize(PDmaTx, WLength);
        PRequestingThread = chThdSelf();
        dmaStreamEnable(PDmaTx);
        chSysLock();
        chSchGoSleepS(THD_STATE_SUSPENDED); // Sleep until end
        chSysUnlock();
        dmaStreamDisable(PDmaTx);
    }
    // Read if needed
    if(RLength != 0) {
        if(WaitEv8() != OK) return FAILURE;
        // Send repeated start
        SendStart();
        if(WaitEv5() != OK) return FAILURE;
        SendAddrWithRead(Addr);
        if(WaitEv6() != OK) { SendStop(); return FAILURE; }
        // If number of data to be read is 1, then DMA cannot be used
        if(RLength == 1) {
            AckDisable();
            SendStop();
            if(WaitRx() != OK) return FAILURE;
            *RPtr = ReceiveData();
            if(WaitStop() != OK) return FAILURE;
            return OK;
        }
        else {  // more than 1 byte, use DMA
            AckEnable();
            dmaStreamSetMemory0(PDmaRx, RPtr);
            dmaStreamSetTransactionSize(PDmaRx, RLength);
            DmaLastTransferSet(); // Inform DMA that this is last transfer => do not ACK last byte
            PRequestingThread = chThdSelf();
            dmaStreamEnable(PDmaRx);
            chSysLock();
            chSchGoSleepS(THD_STATE_SUSPENDED); // Sleep until end
            chSysUnlock();
            dmaStreamDisable(PDmaRx);
        } // if lng==1
    } // if != 0
    SendStop();
    return OK;
}
开发者ID:Kreyl,项目名称:nute,代码行数:58,代码来源:kl_lib_f100.cpp


示例13: pinMode

String MultiReceiver::ReceiveMulti()
{
	pinMode(_pinId, INPUT);

	ResetVariables();
	WaitForLongLow();
	RearrangeReadings();
	return ReceiveData();
}
开发者ID:Tridy,项目名称:MultiReceiver-433.92,代码行数:9,代码来源:MultiReceiver.cpp


示例14: KEXDEBUG

/**
  DMA complete notification handler function. This function will be called
  by the PDD from the DMA Rx service function on successful DMA Rx operation.
  It notifies the user about receive request completion.
  
  @param	aSize
  			Accumulated size of data received over all individual reads.
  			aResult
  			DMA operation return value.
*/
 void DExDriverLogicalChannel::RxDmaComplete(TInt aSize, TInt aResult)
 	{
 	
 	KEXDEBUG(Kern::Printf("++DExDriverLogicalChannel::RxDmaComplete")); 	
 	
 	
	// Action required only if a Rx request is issued and is pending
	//
	if (iRxDataStatus)	
		{
		// If this function is called on error condition, fail the user request
		if (aResult==KErrGeneral)
			{
			// Complete the current request with the abort result.
			Kern::RequestComplete(iClient,iRxDataStatus,aResult);
			return;
			}
						
		// aSize will have the number of bytes recieved in the transfer.
	 	iBytesRxed = iBytesRxed-aSize;
	 	
	 	// Calculate the offset till where the data is written.
		iRxOffset+=aSize;
		
		if (iBytesRxed<=0)
				{
				Kern::RequestComplete(iClient,iRxDataStatus,KErrNone);	
				return;
				}
				
		// If the DFC is scheduled on a Rx timeout condition, then
		// complete the request with timeout result
		//
		if (aResult==KErrTimedOut)
			{	
			
				// Complete the current request with the timeout result.
				Kern::RequestComplete(iClient,iRxDataStatus,aResult);
			return;
			}
	 	
	 	
	 	// If we have reached the end of the chunk.
	 	// then wrap around to the initial offset position. (User specified Offset)
	 	if (iRxOffset == Pdd()->iRxChunk->iSize)		
	 		{
	 		iRxOffset =  iRxInitialOffset;
	 		}
		
		// Re-start receiving the data
		ReceiveData(iRxOffset,iBytesRxed);
		
		
		return;		
		}
 	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:66,代码来源:d_exchnk_ldd.cpp


示例15: connect

void CReceiverThread::Initialize( )
{
    QString strParkID = pWinPort->objectName( );
    strParkID = pConfig->GetComParkID( strParkID );
    pParserThread = CParserThread::CreateThread( strParkID );
    connect( pWinPort, SIGNAL( readyRead( ) ),
             this, SLOT( ReceiveData( ) ) );
    connect( pParserThread, SIGNAL( Log( QString, bool ) ),
             this, SLOT( HandleLog( QString, bool ) ) );
}
开发者ID:Anne081031,项目名称:ParkCode,代码行数:10,代码来源:creceiverthread.cpp


示例16: GetClientIndexFromSocket

void CNetRender::ReceiveFromClient()
{
	// get client by signal emitter
	QTcpSocket *socket = qobject_cast<QTcpSocket *>(sender());
	int index = GetClientIndexFromSocket(socket);
	if(index != -1)
	{
		ReceiveData(socket, &clients[index].msg);
	}
}
开发者ID:gitter-badger,项目名称:mandelbulber2,代码行数:10,代码来源:netrender.cpp


示例17: SendData

void BufferIOEvent::OnEvents(uint32_t events) {
  /// The WRITE events should deal with before the READ events
  if (events & IOEvent::WRITE) {
    SendData();
  }
  if (events & IOEvent::READ) {
    ReceiveData();
  }
  if (events & IOEvent::ERROR) {
    OnError(errno, strerror(errno));
  }
}
开发者ID:Dutch-Man,项目名称:EventLoop,代码行数:12,代码来源:fd_handler.cpp


示例18: UserFunc_1

static void UserFunc_1(void)
{
    /*network*/
        
    ReceiveData();
    SendData(); 
    
    #ifdef DEBUG_PC
    //inData.readStatus = READ_OK;
    #endif
 
}
开发者ID:andrey-mcs,项目名称:start-finish-system,代码行数:12,代码来源:myDelay.c


示例19: ReceiveData

void
BluetoothDaemonConnectionIO::OnSocketCanReceiveWithoutBlocking()
{
  ssize_t res = ReceiveData(GetFd());
  if (res < 0) {
    /* I/O error */
    RemoveWatchers(READ_WATCHER|WRITE_WATCHER);
  } else if (!res) {
    /* EOF or peer shutdown */
    RemoveWatchers(READ_WATCHER);
  }
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:12,代码来源:BluetoothDaemonConnection.cpp


示例20: MOZ_ASSERT

void
UnixSocketConsumerIO::OnSocketCanReceiveWithoutBlocking()
{
  MOZ_ASSERT(MessageLoopForIO::current() == GetIOLoop());
  MOZ_ASSERT(GetConnectionStatus() == SOCKET_IS_CONNECTED); // see bug 990984

  nsresult rv = ReceiveData(GetFd(), this);
  if (NS_FAILED(rv)) {
    RemoveWatchers(READ_WATCHER|WRITE_WATCHER);
    return;
  }
}
开发者ID:evelynhung,项目名称:gecko-dev,代码行数:12,代码来源:UnixSocket.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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