hesam
hesam

Reputation: 1

dot net programing udp buffersize error

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!

Upvotes: 0

Views: 1620

Answers (1)

jgauffin
jgauffin

Reputation: 101130

Quote from wikipedia:

The field size sets a theoretical limit of 65,535 bytes

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.

Upvotes: 2

Related Questions