socket.send can send less data than provided #10002

Closed
opened 2026-08-29 10:40:59 +00:00 by miguel · 0 comments
Owner

When sending large payloads, the low-level socket.send function may decide to send only a portion of the data. The return value should be checked to see if some data was not sent.

Possible fix (not thread safe):

        length = len(out_data)
        while length > 0:
            length -= self.sock.send(out_data[-length:])

Reference: https://github.com/miguelgrinberg/simple-websocket/issues/45

When sending large payloads, the low-level `socket.send` function may decide to send only a portion of the data. The return value should be checked to see if some data was not sent. Possible fix (not thread safe): ```python length = len(out_data) while length > 0: length -= self.sock.send(out_data[-length:]) ``` Reference: https://github.com/miguelgrinberg/simple-websocket/issues/45
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
miguelgrinberg/simple-websocket#10002
No description provided.