Examples/KniPong/main.cpp
/**
 * Reworked drainbuf from netcat. See description in pingPongProcess
 */
Reworked drainbuf from netcat. See description in pingPongProcess
Reworked drainbuf from netcat . See description in pingPongProcess
ssize_t drainbuf(linuxFd fd, unsigned char buff[], size_t& buffPos)
{
	ssize_t n;
	ssize_t adjust;
	n = write(fd, buff, buffPos);
	if (n == -1 && (errno == EAGAIN || errno == EINTR))
		n = WANT_POLLOUT;
	if (n <= 0)
		return n;
	adjust = buffPos - n;
	if (adjust > 0)
		std::memmove(buff, buff + n, adjust);
	buffPos -= n;
	return n;
}
ssize_t drainbuf ( linuxFd fd , unsigned char buff [ ] , size_t & buffPos ) { ssize_t n ; ssize_t adjust ; n = write ( fd , buff , buffPos ) ; if ( n == -1 && ( errno == EAGAIN || errno == EINTR ) ) n = WANT_POLLOUT ; if ( n <= 0 ) return n ; adjust = buffPos - n ; if ( adjust > 0 ) std :: memmove ( buff , buff + n , adjust ) ; buffPos -= n ; return n ; }
Reworked drainbuf from netcat.
Reworked drainbuf from netcat .
/* adjust buffer */