Theldus / wsServer

wsServer - a tiny WebSocket server library written in C
https://theldus.github.io/wsServer
GNU General Public License v3.0
422 stars 80 forks source link

Bug Fix: Ensure all bytes are sent with send() #23

Closed Theldus closed 3 years ago

Theldus commented 3 years ago

Description

In issue #22 it was reported that the send() routine, when sending large amounts of data, did not send them all at once. Technically, this should not happen, since send() should block until all content is sent since we not use O_NONBLOCK.

However, just to be sure of the expected behavior, this PR implements an auxiliary routine that guarantees the sending of all bytes and fails if the sending is not possible.

Thanks to @AfflatusX for the detailed investigation of the problem.

Fixes #22.