Closed halikuosang closed 7 months ago
You have at least three problems:
I don't see any actual NNG bug(s) here.
解决了吗 我也遇到这个问题了
According to my tests, this problem is probably a problem with the latest Windows 11 system, because the problem disappeared after I changed to another system even older Windows 11.
Describe the bug
When I use the push/pull communication method, packet loss occurs. After initializing nng_socket in the push process, calling nng_send to send data at intervals of usleep(1) results in packet loss when using nng_recv in the pull process. The packet loss rate cannot be determined as it occurs randomly. Increasing the usleep interval to usleep(100)/usleep(1000) reduces the packet loss rate, but it still cannot completely avoid packet loss. I want to know if there is a performance bottleneck when using usleep for sending.
I have already tried the following methods, but the packet loss issue remains unresolved:
If you have any suggestions for addressing the packet loss issue, I would greatly appreciate your input.
Expected behavior nng_recv can receive all data without losing packets
Actual Behavior The nng_recv cannot receive all data and has a certain probability of packet loss
To Reproduce See this demo:
Environment Details
Additional context Increasing pull sock's NNG_OPT_RECVBUF to 8K also did not solve the packet loss problem. In addition, the pub/sub communication mode is tested. When pub is sent in us mode, the sub side will also lose data