Skip to content
  • deuce's avatar
    698ca0bd
    Fix socket.send() so that it returns the number of bytes sent. The · 698ca0bd
    deuce authored
    underlying send() function is free to send a subset of the bytes, and
    occasionally does (especially on non-blocking sockets).  The return value
    was true if all bytes were sent or false if not all bytes were sent.
    
    The new behaviour is to return the number of bytes sent or null on failure.
    
    This is mostly compatible with existing code which appears to universally use
    if (!sock.send(str))
    
    Cases where it's not compatible are when a zero-length string is sent.  The
    handling of errors is slightly different now too... previously, if you
    retransmitted on failure, the stream would "stutter" now it will have
    "holes".
    698ca0bd
    Fix socket.send() so that it returns the number of bytes sent. The
    deuce authored
    underlying send() function is free to send a subset of the bytes, and
    occasionally does (especially on non-blocking sockets).  The return value
    was true if all bytes were sent or false if not all bytes were sent.
    
    The new behaviour is to return the number of bytes sent or null on failure.
    
    This is mostly compatible with existing code which appears to universally use
    if (!sock.send(str))
    
    Cases where it's not compatible are when a zero-length string is sent.  The
    handling of errors is slightly different now too... previously, if you
    retransmitted on failure, the stream would "stutter" now it will have
    "holes".
Loading