开发者

UDP transmit performance

开发者 https://www.devze.com 2023-02-22 02:59 出处:网络
I have an application that transmits some data in a loop. Underlying protocol is UDP on WinSock. If I don\'t add sleep(1ms) after each transmit operation mostof the data is not sent (or wireshark can

I have an application that transmits some data in a loop. Underlying protocol is UDP on WinSock. If I don't add sleep(1ms) after each transmit operation most of the data is not sent (or wireshark can not capture it) Have you experienced such a behavour that开发者_JAVA百科 UDP does not handle repetitive sending in a loop ?

Regards

Tugrul


First thing you should check the return values when you send data to check if data is successfully sent or not. Second thing, This can happen internal buffer of UDP cannot accommodate more data because previous data is yet not transmitted. So the simplest solution is that each time before send the data you should check if your UDP socket is writable or not. You can do it by calling "select" or "poll" on that UDP socket.

0

精彩评论

暂无评论...
验证码 换一张
取 消