LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

UDP write error 55 when sending video over network


benO-IT wrote:

Hello Rolf,

 

 

For my test bench, the tranfert with UDP message was a test for the Device Under Test. And i have to send lot of little packets to the DUT. I was working on the same PC with video player (like VLC) with the expectede rate, and with LabView, it was impossible to have the same transfert rate with little packets. There is a limitation on LabView. I think that N.I. should optimize the 'UDP write function'.

 

 

Regards,

 

Ben.


Most likely VLC does some internal smart data merging for small packets before passing them to the TCP/IP socket. So a large part of the speed difference you see is likely due to the smarts of the VLC developers how they use the TCP/IP sockets and in order to get a similar performance you would have to have the same smarts to do something similar in LabVIEW. LabVIEW's TCP/IP and UDP functions do have some internal overhead compared to calling the socket API directly but also offer quite a bit of ease of use in comparison to use socket functions directly. But for really big performance differences you really should search it in the implementation on top of those functions.

 

I'm 100% that VLC is not simply dumping the data to the network socket as is but has some pretty involved software to optimize that, based on packet size, underlaying network speed determined from earlier transmission, and probably half a dozen other parameters that are dynamically adapted to the actual situation.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 23
(3,709 Views)

I agree with  rolfk.  We have an application where we need to post messages via UDP broadcast.  Our transmission rate is severly hampered by the NI LV send.

 

There definetly needs to be an advanced UDP send that does not inhibit the transmission rate.

0 Kudos
Message 12 of 23
(3,700 Views)

My first attempt was to use a 1 ms delay between each call to UPD write.  That resulted in a net data transfer rate of ~ 2 Mbps on a 10/100 network.  Changing packet sizes etc. does have some affect.

 

I then modified my code so that when I receive an error, I go into a while loop and keep trying to send the same data until the error goes away. That resulted in a net data transfer rate of ~ 20 Mbps for the same packet sizes.

 

It seems to me using a timeout can severely impact throughput and may not solve the problem anyway.

 

Looking at the details of the Winsock sendto() function, the default behavior is to block if there is no internal buffer available. It then returns the number of bytes written.  The NI UDP write function returns right away with the error 55.

 

I agree there needs to be a more advanced UDP write function and knowing the number of bytes written would be useful.

 

John.

 

0 Kudos
Message 13 of 23
(3,692 Views)

JohnSantaFe wrote:

My first attempt was to use a 1 ms delay between each call to UPD write.  That resulted in a net data transfer rate of ~ 2 Mbps on a 10/100 network.  Changing packet sizes etc. does have some affect.

 

I then modified my code so that when I receive an error, I go into a while loop and keep trying to send the same data until the error goes away. That resulted in a net data transfer rate of ~ 20 Mbps for the same packet sizes.

 

It seems to me using a timeout can severely impact throughput and may not solve the problem anyway.

 

Looking at the details of the Winsock sendto() function, the default behavior is to block if there is no internal buffer available. It then returns the number of bytes written.  The NI UDP write function returns right away with the error 55.

 

I agree there needs to be a more advanced UDP write function and knowing the number of bytes written would be useful.

 

John.

 


While blocking operation for sendto() is indeed default behaviour (not just for Winsock but for all Berkely based socket implementations AFAIK) it is seldom used for more involved data transfer protocols. Blocking operation is nice because it allows to do traditional sequential programming without having to deal much with error handling and nothing at all about retrying but it takes out all control from the application. It leaves it to the socket to do more or less efficient waiting on the final event but that is about it. The application thread is fully blocked and that has many other not so nice implications for an application.

 

In order to get the maximum performance one has to implement in most cases non-blocking operation which in the case of sockets is a bit of a hassle. But most somewhat advanced communication libraries take the bite and use non-blocking socket operation and handle the waiting and all the rest themselves. LabVIEW does that too and passes the non-0blocking behaviour mostly to the application level. And that is a fairly smart move. You can fairly easily implement blocking behaviour on top of a non-blocking implemention but the reverse is basically impossible.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 14 of 23
(3,685 Views)

hi guys,

 

first of all sorry for my bad english. hmmmm........ok. now i have a problem in UDP connection (Labview). i want to transfer data betwen two Pcs. the file size is in byts and file transfer utility is not used frequently in my project. so have done vis. (atteched below) in Labview (UDP) and they are working fine (as a VIs). but when i am trying make an exe. my exe are not working and give me an error (ERROR 54).i had tried lot, but i dint get any solutions yet. 

 

what should i do..?

Alpesh Prajapati
Download All
0 Kudos
Message 15 of 23
(3,470 Views)

Hi Alpesh,

 

Which VI do you create an executable from? Make sure that the network address is entered correctly when you run the executable. The following knowledgebase article desribes possible reasons for this error: http://digital.ni.com/public.nsf/allkb/31F0690C13D5BAAE86256D21007B3CAB?OpenDocument

Vivek Nath
National Instruments
Applications Engineer
Machine Vision
0 Kudos
Message 16 of 23
(3,419 Views)

hi vivek,

 

untitled 1.vi is my main VI. i want to make exe from this VI. i alredy go through the link, suggested by you. i am still waiting for solutions.

 

i had made an error Indictor on UDP port-open VI error terminal. i had not get any error in VI while running, but when i made the exe and run; it gaves me this error "ERROR54". all inputs (ip address, port etc) were set to the default value in vi and exe. 

Alpesh Prajapati
0 Kudos
Message 17 of 23
(3,398 Views)

And this is on the same computer you are running the VI on?

 

Because the only address you enter with UDP Open is the local network address. You only need to wire that address if you want the UDP socket to be bound to a specific internal network card on your computer, for instance when you have more than one network interface in your computer and want to make sure, the traffic will always go over a specific network interface.

 

But since you use the same address also as address to specify to whom you want to send the message, this is almost 100% wrong. If you would want to send to the local computer you would enter 127.0.0.1 or localhost, not the IP address of a local network interface. Since you enter a normal IP address this likely is the remote address and there is of course no way that the socket driver could bind the local side of the network socket to a remote address and it properly returns a "bad address" error.

 

This should be the same in the LabVIEW development environment.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 18 of 23
(3,394 Views)

Hello. Sorry to revive this thread but I have a somewhat similar issue. I have a UDP Sender program that worked extremely well while using Windows Vista on the PC. I was able to transmit data at rates upwards of 8 Mbps. Unfortunately, the PC the program was on had to be reformatted and the OS replaced to XP. I reinstalled the same software build and for some reason I can barely get a steady data rate above 4 Mbps. I would occasionally reach 8 Mbps but rarely as opposed to always when the OS was Vista.

 

Any insights?

0 Kudos
Message 19 of 23
(3,055 Views)

671:

 

If the program and hardware are unchanged, then it is likely that the difference stems from the driver itself. Were you using a manufacturer-specific driver for your network interface card originally? It's also possible that there were better network stack optimizations in Vista, although that's just a guess on my part.

 

I would try updating the network drivers to see if there's any change in behavior.

Caleb Harris

National Instruments | http://www.ni.com/support
0 Kudos
Message 20 of 23
(3,030 Views)