Ejemplo n.º 1
0
static
void pspsm_send_eof(pspsm_con_info_t *con_info)
{
	psm_mq_req_t req = PSM_MQ_REQINVALID;
	char dummy;

	_pspsm_send_buf(con_info, &dummy, 0, con_info->send_id | PSPSM_MAGIC_EOF, &req, 3);
	psm_mq_wait(&req, NULL);
	con_info->con_broken = 1; /* stop sending */
}
Ejemplo n.º 2
0
int main(void)
{
  psm_ep_t ep;
  psm_epid_t epid, remote_epid;
  psm_mq_t mq;

  psm_epaddr_t *epaddrs;

  char *send = (char*)malloc(BUF_SIZE);
  memset(send, 1, BUF_SIZE);
  char *recv = (char*)malloc(BUF_SIZE);
  memset(recv, 1, BUF_SIZE);
  psm_mq_req_t req;

  init_ep(&ep, &epid);
  write_epid((char*)&epid, sizeof(psm_epid_t), SPATH);
  sleep(5);
  read_epid((char*)&remote_epid, sizeof(psm_epid_t), CPATH);

  fprintf(stderr, "connecting...");
  connect_endpoints(ep, 1, &remote_epid, &epaddrs);
  fprintf(stderr, "done\n");

  init_mq(&ep, &mq);
  int len = 128;
  int repeat;
  int i ;
  while (len < BUF_SIZE) {
    if (len < 8388608) repeat = 1000;
    if (len < BUF_SIZE) repeat = 10;
    repeat = 10;
    for (i = 0; i < repeat; i++) {
      //      fprintf(stderr, "recv: %d\n", len);
      psm_mq_irecv(mq, 0, 0, 0, recv, len, NULL, &req);
      psm_mq_wait(&req, NULL);
      //      fprintf(stderr, "send: %d\n", len);
      psm_mq_send(mq, *epaddrs, 0, 0, send, len);
      //    fprintf(stderr, "recvd: \n");
    }
    len = len << 1;
  }

  sleep(100000);
  return 1;
}