size_t TcpClient::peekStream(byte *rgbPeek, size_t cbPeekMax, size_t index) { size_t cbReady = 0; if( (cbReady = available()) > 0 ) { if(index >= cbReady) { return(0); } cbReady -= index; cbReady = cbReady < cbPeekMax ? cbReady : cbPeekMax; return(TCPPeekArray(_hTCP, rgbPeek, cbReady, index)); } return(0); }
/// @cond debug //*************************************************************************** // Only internal ude: // cTCPpRead callback function //*************************************************************************** int cTCPpRead() { WORD resbool; BYTE* tempByte; tempByte = (BYTE*)xByte; if(xInt2 > xInt) xInt2 = xInt; resbool = TCPPeekArray(xSocket, xByte, xInt, xInt2); if(resbool > 0) { *(tempByte+resbool) = '\0'; return (int) resbool; } else { *(tempByte) = '\0'; return -1; //error value... } }