src/client.c
/** send data on wire and return number of bytes sent */
send data on wire and return number of bytes sent
send data on wire and return number of bytes sent
int c_send_data_wire(client_st *p, const unsigned char *buf, unsigned int len_in)
{
    int rv;
    int off;
    unsigned int len = len_in;
    ASSERT(p->state != CLIENT_CLOSING);
    off = 0;
    while (len) {
        rv = send(p->sd, buf + off, len, 0);
        if (rv < 0) {
            snprintf(l_reason, sizeof(l_reason),
                    "send error rv %d, errno %d (%s)", rv, errno, strerror(errno));
            c_disconnect(p, l_reason);
            return 0;
        }
        else if (rv == 0) {
            break;
        }
        len -= rv;
        off += rv;
    }
    LOG_DEBUG("c_send_data_wire sd %d, len %d", p->sd, len_in);
    return off;
}
int c_send_data_wire ( client_st * p , const unsigned char * buf , unsigned int len_in ) { int rv ; int off ; unsigned int len = len_in ; ASSERT ( p -> state != CLIENT_CLOSING ) ; off = 0 ; while ( len ) { rv = send ( p -> sd , buf + off , len , 0 ) ; if ( rv < 0 ) { snprintf ( l_reason , sizeof ( l_reason ) , " " , rv , errno , strerror ( errno ) ) ; c_disconnect ( p , l_reason ) ; return 0 ; } else if ( rv == 0 ) { break ; } len -= rv ; off += rv ; } LOG_DEBUG ( " " , p -> sd , len_in ) ; return off ; }
send data on wire and return number of bytes sent
send data on wire and return number of bytes sent