UDP多个实例同时发送请求,只能收到一个或两个响应

发布于 2022-08-29 20:11:49 字数 2694 浏览 8 评论 0

iOS项目中使用GCDAsyncUdpSocket进行udp通讯,但是在并发的情况下,同时发送6个请求,每次只能收到一个或两个响应,下面是输出的日志信息,不明白为什么总是只能收到一个请求的响应

2014-09-11 16:30:13.624 UDPConcurrent[2553:60b] self is <GCDAsyncUdpSocket: 0x15d5bb60> gcd send to 192.168.0.143 port is 56797 and data is <000633ad 3568>
2014-09-11 16:30:13.629 UDPConcurrent[2553:60b] self is <GCDAsyncUdpSocket: 0x15d5d570> gcd send to 192.168.0.143 port is 56797 and data is <00065dad 1908>
2014-09-11 16:30:13.634 UDPConcurrent[2553:60b] self is <GCDAsyncUdpSocket: 0x15e6f4b0> gcd send to 192.168.0.143 port is 56797 and data is <000717ad 012820>
2014-09-11 16:30:13.635 UDPConcurrent[2553:60b] self is <GCDAsyncUdpSocket: 0x15d5e860> gcd send to 192.168.0.143 port is 56797 and data is <000717ad 026821>
2014-09-11 16:30:13.638 UDPConcurrent[2553:60b] self is <GCDAsyncUdpSocket: 0x15e6fb70> gcd send to 192.168.0.143 port is 56797 and data is <000753ad 016835>
2014-09-11 16:30:13.640 UDPConcurrent[2553:60b] self is <GCDAsyncUdpSocket: 0x15d5ef20> gcd send to 192.168.0.143 port is 56797 and data is <000753ad 022834>
2014-09-11 16:30:13.643 UDPConcurrent[2553:60b] self.request1 is <GCDAsyncUdpSocket: 0x15d5bb60>
2014-09-11 16:30:13.645 UDPConcurrent[2553:60b] self.request2 is <GCDAsyncUdpSocket: 0x15d5d570>
2014-09-11 16:30:13.647 UDPConcurrent[2553:60b] self.request3 is <GCDAsyncUdpSocket: 0x15e6f4b0>
2014-09-11 16:30:13.649 UDPConcurrent[2553:60b] self.request4 is <GCDAsyncUdpSocket: 0x15d5e860>
2014-09-11 16:30:13.650 UDPConcurrent[2553:60b] self.request5 is <GCDAsyncUdpSocket: 0x15e6fb70>
2014-09-11 16:30:13.652 UDPConcurrent[2553:60b] self.request6 is <GCDAsyncUdpSocket: 0x15d5ef20>
2014-09-11 16:30:13.670 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15d5bb60> port is 49172 and tag is 1
2014-09-11 16:30:13.672 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15d5d570> port is 54971 and tag is 2
2014-09-11 16:30:13.674 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15e6f4b0> port is 55715 and tag is 3
2014-09-11 16:30:13.676 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15d5e860> port is 51186 and tag is 4
2014-09-11 16:30:13.678 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15e6fb70> port is 53467 and tag is 5
2014-09-11 16:30:13.680 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15d5ef20> port is 64005 and tag is 6
2014-09-11 16:30:13.686 UDPConcurrent[2553:60b] socket is <GCDAsyncUdpSocket: 0x15d5ef20> port is 64005 and response data is <000f34da 00199437 a2720000 002b0f>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文