Example #1
0
A pString_Connection::syncSendCover(A msg_, A aTimeout)
{
  struct timeval gameover, *tvp;
  I rc;

  ipcWarn(wrnlvl(),"%t pString_Connection::syncSend\n");

  tvp = atotv(aTimeout, &gameover);
  if(writeChannel()==0) return syncErrorResult("nochan","channel is null");
  
  /* put stuff on queue */
  int dataSize     = msg_->n;
  int bufferSize   = HeaderLength  +dataSize;
  int temp         = htonl(dataSize);

  MSBuffer *sb=new MSBuffer( bufferSize);
  if(NULL==sb) return syncErrorResult("Buffer","new MSBuffer routine failed.");
  sb->stuff((char *)(&temp), HeaderLength);
  sb->stuff((const char *)msg_->p, dataSize);
  sendTheBuffer(sb);

  /* while loop on select() until timeout or write queue empty */
  rc=syncWriteLoop(tvp);
  if(0>rc) return syncErrorResult(errorSymbol,errorMessage);
  else return gvi(Et,3,gsym("OK"),gi(rc),writeQueueStatus());
}
Example #2
0
A getAbsoluteTimeout(A aobj_)
{
  struct timeval gameover, *tvp;
  ipcWarn(0,"%t getAbsoluteTimeout\n");

  tvp = atotv(aobj_, &gameover);
  if (NULL==tvp) return(A)0;
  else return gvi(It,3,tvp->tv_sec,tvp->tv_usec,1);
}
Example #3
0
A pString_Connection::syncReadCover(A aTimeout)
{
  struct timeval gameover, *tvp;
  A dataobj;
  ipcWarn(wrnlvl(),"%t pString_Connection::SyncRead\n");

  tvp = atotv(aTimeout, &gameover);
  if(readChannel()==0) return syncErrorResult("nochan","channel is null");

  /* while loop on select() until timeout or complete message received */
  dataobj=syncReadLoop(tvp);
  if (dataobj) return gvi(Et,3,gsym("OK"),dataobj,aplus_nl);
  else return syncErrorResult(errorSymbol, errorMessage);
}