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

PComm::PCRawWrite ( char *  mesg  ) 

writes directly to the current socket.

Parameters:
mesg the character string which it will write
Sends a command directly to the socket without any preprocessing

Returns:
number of bytes actually written
See also:
pcrdef.h PCRawRead(char *mesg)

Definition at line 304 of file pcomm.cpp.

References fd, FDSet, timeOut, writeBuf, and writeCtr.

{

    bzero(writeBuf, sizeof(writeBuf));
    strcpy(writeBuf, mesg);

    if (select(fd+1, NULL, FDSet, NULL, timeOut)) {
      writeCtr = write(fd, writeBuf, strlen(writeBuf));
    } else {
#ifdef DEBUG_VER_
          fprintf(stderr, "PCRawWrite Time Out on socket %d\n", fd);
#endif // DEBUG_VER_ 
      writeCtr = 0;
    }

    if ((unsigned)writeCtr!=strlen(writeBuf)) {
        return (-1);
    }

    return writeCtr;
   
}


Generated by  Doxygen 1.6.0   Back to index