C ++ UDP套接字数据包排队 [英] C++ UDP sockets packet queuing

查看:99
本文介绍了C ++ UDP套接字数据包排队的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用相同的UDP套接字发送和接收数据.我想知道DGRAM套接字的数据包排队是否已经存在,还是我们必须单独处理它.

I am using the same UDP socket for sending and receiving data. I am wondering if packet queuing for DGRAM sockets is already present, or do we have to handle it separately.

如果用户代码必须处理队列,如何完成?我们是否有单独的线程可以接收套接字的套接字,并将数据包放入reciver_queue中,并从另一个send_queue中发送出去?

If the user code has to handle queueing, how is it done? Do we have separate threads to recvfrom for the socket and put the packet in the reciver_queue and to sendto from another sending_queue?

一个示例代码绝对很棒.感谢您的帮助.

An example code will be absolutely awesome. Thanks for your help.

推荐答案

有一个数据包队列.但是,当数据包队列已满时,UDP数据包开始被丢弃.当它们被丢弃时,它们将永远丢失,因此请确保您继续读取数据!

There is a packet queue. However when the packet queue is filled then UDP packets start getting discarded. When they are discarded they are lost forever so make sure you keep reading data!

这篇关于C ++ UDP套接字数据包排队的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆