예제 #1
0
파일: main.cpp 프로젝트: WhiZTiM/coliru
    void on_data_recv(boost::system::error_code/* ec */, size_t /*bytes_transferred*/) {
        {
            boost::lock_guard<boost::mutex> lk(global_stream_lock);
            std::cout << "[" << boost::this_thread::get_id() << "] bytes rcvd: " << std::endl;
        }

        data_recv(); // call function that waits for more data
    }
예제 #2
0
static void MESSAGE_recv(struct mwServiceConference *srvc,
			 struct mwConference *conf,
			 struct mwGetBuffer *b) {

  /* - look up who send the message by their id
     - trigger the event
  */

  guint16 id;
  guint32 type;
  struct mwLoginInfo *m;

  /* an empty buffer isn't an error, just ignored */
  if(! mwGetBuffer_remaining(b)) return;

  guint16_get(b, &id);
  guint32_get(b, &type); /* reuse type variable */
  guint32_get(b, &type);

  if(mwGetBuffer_error(b)) return;

  m = MEMBER_FIND(conf, id);
  if(! m) {
    g_warning("received message type 0x%04x from"
	      " unknown conference member %u", type, id);
    return;
  }
  
  switch(type) {
  case 0x01:  /* type is text */
    text_recv(srvc, conf, m, b);
    break;

  case 0x02:  /* type is data */
    data_recv(srvc, conf, m, b);
    break;

  default:
    g_warning("unknown message type 0x%4x received in conference", type);
  }
}
예제 #3
0
파일: app.cpp 프로젝트: amcclung/BLEShield
void lib_aci_data_rcvd_hook(aci_evt_t *p_rcvd_evt_data, uint8_t data_len)
{
  aci_evt_params_data_received_t *p_data_rcvd_data;
  p_data_rcvd_data = &(p_rcvd_evt_data->params.data_received);
//  LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_PIPE_UPDATED_PIPE_NUM, p_data_rcvd_data->rx_data.pipe_number);
//  LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_PIPE_UPDATED_DATA0, p_data_rcvd_data->rx_data.aci_data[0]);
//  LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_DATA_RECEIVED_LEN, data_len);

  if (p_data_rcvd_data->rx_data.pipe_number == PIPE_BLESHIELD_TX_DATA_RX)
  {
    data_recv( p_data_rcvd_data->rx_data.aci_data, data_len );
  }
  else  if (p_data_rcvd_data->rx_data.pipe_number == PIPE_BLESHIELD_RESETWRITE_RX)
  {
    write_ready = 1;
  }

  /* Start Place holder code - Edit code here to process this Event data */
  data_len = 0;
  /* End Place holder code */  
}
예제 #4
0
파일: Server.cpp 프로젝트: Mebus/iperf
/* -------------------------------------------------------------------
 * Receive data from the (connected) socket.
 * Sends termination flag several times at the end.
 * Does not close the socket.
 * ------------------------------------------------------------------- */
void Server::Run( void ) {
	if (mSettings->mDirection == kClientToServer)
		data_recv(mSettings, mBuf, mEndTime);
	else
		data_send(mSettings, mBuf, mEndTime);
}