From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Increase UDP sending size over 64k bytes and get error -113,sending buffer not enough

Solved!
Go to solution

Dear all,

 

I have a case that I must send a data over 64k bytes in a socket with UDP . I got a error-113 shows "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 was smaller than the datagram itself.".I searched for this issue and got the closest answer as below:

http://digital.ni.com/public.nsf/allkb/D5AC7E8AE545322D8625730100604F2D?OpenDocument

 

It said I have to change buffer size with Wsock.dll. I used the same mathod to increaes the send buffer to 131072 bytes by choice optionname to so_sndbuf (x1001) and give it value with 131072 and it worked fine without error. However I still got an error 113 while sending data with " UDP Write.vi ". It seems UDP write.vi reset the buffer size? Are there any other things cause the error?

I attached example code. In UDP Sender.vi you can see I change send buffer size to 131072 and send date included a 65536 bytes data.There is also a UDP receiver.vi and there is some missing VI which you can get from the LINK. But it's not necessary.

 

Download All
0 Kudos
Message 1 of 4
(7,525 Views)
Solution
Accepted by TC_Raymond

The header for a UDP packet includes a 16 bit field that defines the size of the UDP message (HEADER AND DATA)

 

16 bits limits you to a total size of 65635 bytes, minus the header sizes; a minimum of 20 bytes are required to define an IP packet and 8 bytes for UDP leaving an effective data payload of 65507

 bytes.

 

LabVIEW is not the issue...

 

http://en.wikipedia.org/wiki/User_Datagram_Protocol#Packet_structure

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 2 of 4
(7,498 Views)

Hello, may you please give me your Set_Receiver_Buffer.vi, I encountered the same problem as you, this is my email: 1281212249@qq.com

0 Kudos
Message 3 of 4
(4,629 Views)

Did you read the initial post? The VI you ask for is simply attached to that post! Just download it!

 

But you still can’t send more than 65507 bytes per UDP message. Unlike the stream character of TCP, UDP is a datagram based protocol. It doesn’t implement a fragmented transfer of datagrams, but the underlaying IP dataframe is limited to 65535 bytes in total.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 4
(4,622 Views)