LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not receiving UDP packets

Hi everyone,

 

I am trying to set up a desktop computer with LabVIEW to receive UDP packets from an embedded processor (DaVinci DM355) via UDP over ethernet. The problem is that I do not seem to be receiving any packets when I try to use LabVIEW's example VI:

National Instruments\LabVIEW 8.6\examples\comm\UDP.llb\UDP Receiver.vi

 

Here's a more detailed description of the setup:

  • Embedded processor:
    • It sends a packet of data (104 bytes) via UDP to an IP address (192.168.1.77) and port (3257) at a constant rate (4Hz)
    • It is connected to the desktop computer with an ethernet cable.
  • Desktop computer:
    • I set up the computer to have the appropriate IP address (192.168.1.77) and subnet mask (255.255.255.0) under Control Panel, Network Connections, Local Area Connection Properties, Internet Protocol Version 4 (TCP/IPv4) Properties
    • I open "UDP Receiver.vi", set the appropriate port number (3257), and run the VI.
    • I do not see any data being received under "# of Bytes Received" or "Data Received"

 

To ensure that the desktop computer is actually receiving the packets, I used Wireshark to capture packets sent over ethernet. I've attached a screenshot of the capture.

 

Here's some other things that I have tried:

  • I've run the simple examples "UDP Sender.vi" and "UDP Receiver.vi" on the same computer. As expected, it works fine.
  • I've run LabVIEW on two different computers: one running "UDP Sender.vi" and the other running "UDP Receiver.vi". I set up the IP addresses on both computers to be on the same network and connected them with an ethernet cable. Again, this works fine.

 

Hopefully I am missing something simple somewhere. Does anyone know what could be wrong?

 

Thanks!

0 Kudos
Message 1 of 19
(12,470 Views)

I can't see anything why it shouldn't work after a quick look.

 

some things I noticed:

- You use same port to sent (at transmitter-DaVinci) and receive (the PC). What happens if these are different (this is a typical case)?

- Are you sure that you don't have firewall running somewhere that blocks the IP number of the DaVinci?

- Are you sure that you released the UDP port at the receiving end (no other application running in the background that still uses this port)?

- Are you using multiple ethernet cards in your PC? If so you should specify the correct one when configuring the receiver.

---

25+ years long fan of LabVIEW. Move to Emerson looks to be for the better! See the last posts in subscription model thread.
0 Kudos
Message 2 of 19
(12,459 Views)

Thanks for the response!

 

- You use same port to sent (at transmitter-DaVinci) and receive (the PC). What happens if these are different (this is a typical case)?

 

Yeah, I noticed this as well when I ran Wireshark (I did not program the DaVinci). I'll see if I can change this and see what happens.

 

 

- Are you sure that you don't have firewall running somewhere that blocks the IP number of the DaVinci?

 

As far as I know, I only have Windows Firewall. After checking the properties, it looks like "LabVIEW 8.6 Development System" for both UDP and TCP are unblocked. Is there a simple way to make sure that packets aren't being blocked by a firewall?

 

 

- Are you sure that you released the UDP port at the receiving end (no other application running in the background that still uses this port)?

 

I am not running any other applications that use the port (maybe there are some other applications that I am unaware of though). Is there a way to check this?

 

 

- Are you using multiple ethernet cards in your PC? If so you should specify the correct one when configuring the receiver.

No. Perhaps off topic, but, won't LabVIEW listen on all ethernet cards if I had multiple?

0 Kudos
Message 3 of 19
(12,447 Views)

If you only use the windows firewall it is easy to check this. If you have administrator rights you can just switch it off (for debugging).

 

I just checked, if the port is already in use you will get an error when you start the UDP receiver immediatly (error #60).

 

I never used multiple card myself but was aware of the 'net adress', quickly checked the help and it mentions that by default it works on all.

 

 

so I am afraid you can already tick all the things I mentioned 😞

 

 

 

---

25+ years long fan of LabVIEW. Move to Emerson looks to be for the better! See the last posts in subscription model thread.
0 Kudos
Message 4 of 19
(12,442 Views)

Was your Wireshark trace taken on the PC or was it captured from a different machine? If you ran the trace on the PC then I would check your code to see if any errors are being generated. I have used the basic examples as well as written several other UDP applications and have not had any issues. UDP can throw errors if your read buffer is smaller than the data packet.

 

 With respect to your last question yes, LabVIEW can listen on all interfaces. This is the default if you have multiple interfaces and you don't specify the IP Address for the listener.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 19
(12,436 Views)

The wireshark trace was taken on the same PC. I'll check to see if any errors are thrown. If there were errors, none of them caused the program to stop (it stops the infinite loop if the error status becomes true).

 

I'll try some of the things suggested above and post the results.

0 Kudos
Message 6 of 19
(12,421 Views)

Are you using a cross-over cable for your peer-to-peer connection?

 

If not, then you need to get one or use a router between the two computers.

jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 7 of 19
(12,412 Views)

If the wireshark sees the packets, the cable is OK. Double-check the firewall and the UDP receiver settings. 

 

Run the UDP receiver and do a "netstat -an" in a command window. Is it really listening on the right port?

0 Kudos
Message 8 of 19
(12,405 Views)

I tested the system a bit more and the "UDP Receiver.vi" does receive the UDP packets when Wireshark is running at the same time! I don't know why I didn't try running them at the same time before.

 

The setup is the same:

  • I run the VI and don't see any data coming in
  • I then start a Wireshark capture, and LabVIEW immediately starts seeing the UDP packets
  • When I stop the Wireshark capture, LabVIEW stops seeing the UDP packets

One obvious solution is to just run Wireshark all the time. But it would be nice to know why this is happening.

 

It's a bit hard to get internet access where all the hardware is set up so I have not been able to try run "netstat -an". I will soon and hopefully this will provide a bit more info.

 

I also tried disabling Windows Firewall, and that did not seem to have any effect.

0 Kudos
Message 9 of 19
(12,395 Views)

For those who might be wondering: I am just using a regular ethernet cable, not a crossover cable. I guess the computer that I am using has the hardware does the switching automatically (Auto-MDIX).

Message 10 of 19
(12,390 Views)