点网编程udp缓冲区大小错误
我正在尝试通过 UDP 广播套接字发送图像 (byte[])。我 收到以下错误,表明我的消息大于 内部消息缓冲区。
“System.Net.Sockets.SocketException”类型的未处理异常 发生在 System.dll 中
附加信息:数据报套接字上发送的消息较大 超过内部消息缓冲区或其他一些网络限制,或者 用于接收数据报的缓冲区小于数据报 环顾
谷歌,我的印象是这是一个 一般的winsock错误,与.net没有直接关系 执行。我想如果一条消息比 内部缓冲区,winsock 会分解消息并在 UDP 上, 保证订单,但不保证交货。这对于广播来说有什么不同吗 插座?我需要自己处理消息的分解吗?
感谢您的帮助!
I am trying to send an image (byte[]) over a UDP broadcast socket. I
get the following error stating that my message is bigger than the
internal message buffer.
An unhandled exception of type 'System.Net.Sockets.SocketException'
occurred in System.dll
Additional information: A message sent on a datagram socket was larger
than the internal message buffer or some other network limit, or the
buffer used to receive a datagram into was smaller than the datagram
itself
From looking around google, I am under the impression that this is a
general winsock error and not something directly related to the .net
implementation. I thought that if a message was bigger than the
internal buffer, winsock would break up the message and on UDP,
guarantee order, but not delivery. Is this different for a broadcast
socket? Do I need to handle breaking apart the message myself?
Thank you for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
引用自维基百科:
这意味着您不能发送大于 65,535 字节的图像(可能比这个小一点),
如果可以的话,我会在发送图像时避免使用 UDP,因为它不能保证传送或消息顺序。
Quote from wikipedia:
Which means that you cannot send images larger that 65,535 bytes (probably a bit less than that)
I would avoid UDP if I could when sending images, since it do not guarantee delivery or message order.