Logo Search packages:      
Sourcecode: icomlib version File versions  Download package

PComm::PCRawRead ( char *  mesg  ) 

reads directly from the current socket.

Parameters:
mesg malloc'd char string big enough to hold a reply
Reads directly from the socket without any preprocessing

Returns:
number of bytes read.
See also:
pcrdef.h PCRawWrite(char *mesg)

Definition at line 337 of file pcomm.cpp.

References fd, FDSet, readBuf, readCtr, and timeOut.

{
    readCtr = 1;

    bzero(readBuf, sizeof(readBuf));
    bzero(readBuf, sizeof(mesg));

    while(readCtr==1) {
      if (select(fd+1, FDSet, NULL, NULL, timeOut)) {
            readCtr= read(fd, readBuf, sizeof(readBuf));
            strcpy(mesg, readBuf);
      } else {
            readCtr=(-1);
#ifdef DEBUG_VER_
          fprintf(stderr, "PCRawRead Time Out on socket %d\n", fd);
#endif // DEBUG_VER_ 

      }
    }

    return readCtr;
}


Generated by  Doxygen 1.6.0   Back to index