ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Среда
17 сентября
1541339 Топик полностью
Eddy_Em (10.09.2025 17:04, просмотров: 145) ответил IBAH на Долбалбаный линукс! UDP сокет. Хочу читать по байту: recv(fd, &buf, 1, 0); Сука, читает только первый байт из пакета, остальные исчезают. ЧЯДНТ?! Причем ioctl(fd, FIONREAD, &bytes); показывает что весь пакет пришел.
Таков менее матюкливый ответ от гугола. 
Receiving only one byte from a UDP socket while a larger message is available in the buffer can lead to packet drops. This occurs because the recv() or recvfrom() function, when provided with a buffer size of one byte, will only extract the first byte of the incoming UDP datagram. The remaining bytes of that datagram will be discarded, and the next call to recv() will retrieve the next entire UDP datagram from the socket's receive buffer, if one exists.
eddy-em.livejournal.com github.com/eddyem