STCP/network_io_tcp.c
static int _tcp_io(socket_t tcp_sd, void *buf, size_t count, io_func_t io_func)
{
    char *cbuf = (char *) buf;
    size_t bytes_remaining;

    assert(buf && io_func);
    for (bytes_remaining = count; bytes_remaining > 0; )
    {
        int rc;

        if ((rc = io_func(tcp_sd, cbuf, bytes_remaining)) <= 0)
        {
            DEBUG_LOG(("_tcp_io rc: %d\n", rc));
            return rc;
        }

        assert(rc <= (int)bytes_remaining);
        bytes_remaining -= rc;
        cbuf += rc;
    }

    return count;
}
/* read/write count bytes into/from buf */
read/write count bytes into/from buf
read / write count bytes into / from buf
static int _tcp_io(socket_t tcp_sd, void *buf, size_t count, io_func_t io_func)
{
    char *cbuf = (char *) buf;
    size_t bytes_remaining;
    assert(buf && io_func);
    for (bytes_remaining = count; bytes_remaining > 0; )
    {
        int rc;
        if ((rc = io_func(tcp_sd, cbuf, bytes_remaining)) <= 0)
        {
            DEBUG_LOG(("_tcp_io rc: %d\n", rc));
            return rc;
        }
        assert(rc <= (int)bytes_remaining);
        bytes_remaining -= rc;
        cbuf += rc;
    }
    return count;
}
static int _tcp_io ( socket_t tcp_sd , void * buf , size_t count , io_func_t io_func ) { char * cbuf = ( char * ) buf ; size_t bytes_remaining ; assert ( buf && io_func ) ; for ( bytes_remaining = count ; bytes_remaining > 0 ; ) { int rc ; if ( ( rc = io_func ( tcp_sd , cbuf , bytes_remaining ) ) <= 0 ) { DEBUG_LOG ( ( " \n " , rc ) ) ; return rc ; } assert ( rc <= ( int ) bytes_remaining ) ; bytes_remaining -= rc ; cbuf += rc ; } return count ; }
read/write count bytes into/from buf
read / write count bytes into / from buf