LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I read a message with the same Source Port and Destination Port via UDP?

I have a hardware and it sends me UDP messages. The source port and destination port of these UDP Messages are the same. The gui made with C# can read them but I can't. Is there any way to read them?

LV 2024
0 Kudos
Message 1 of 7
(115 Views)

When you open an UDP connection you specify which is the local port. For UDP messages you want to receive this is your message destination port.

 

Then you simply read messages and the UDP Read will return the address and port number from which the UDP package originated. If that doesn't work like this you have one of the following two problems:

 

1) Your computer has multiple network interfaces and the routing configuration of your computer is disabling certain routes. Try to specify the actual net address of your interface on which you expect the messages to arrive on UDP Open.

 

2) Your remote side is not sending standard UDP messages but UDP Multicast messages. This means it sends them to a specific IP address in a range of IP addresses reserved for Multicast operation. Then you would need to use the UDP Multicast Open with the according Multicast IP address.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 7
(97 Views)

@idrisozel wrote:

I have a hardware and it sends me UDP messages. The source port and destination port of these UDP Messages are the same. The gui made with C# can read them but I can't. Is there any way to read them?


Since you are posting in the LabVIEW, can we assume that "I can't" is about a LabVIEW program? UDP is connectionless, so all you need to do is listen at that port and parse the data as needed. Are these unicasts, broadcasts or multicast? What is the destination IP?

 

Have a look at the examples included with LabVIEW. If you think you are doing it wrong, you should show us your code. Also show a full packet header info.

 

Do you get any specific errors? (e.g. can we assume that the port is available to listen and not still reserved by your C# program)

 

Also check firewall rules. Is LabVIEW allowed to access the network? 

0 Kudos
Message 3 of 7
(85 Views)

Hi Altenbach,

Thank you for replies,

I have attached my current UDP reading structure. I have also added the UDP message. I tested it with the firewall closed. I can read from the source port (62000) and destination port (56200) on another device. However, I cannot read when the two port values ​​are the same.

LV 2024
Download All
0 Kudos
Message 4 of 7
(61 Views)

Hi Rolfk,

Thank you for replies,

I gave more details in my other answer. I hope it will be enough.

LV 2024
0 Kudos
Message 5 of 7
(57 Views)

You can tell from the destination IP that these are most likely broadcasts. (Unless you have unusual subnets where it could be a real IP of your computer)

 

What is the IP and subnet mask of the PC?

 

I currently can't look at your code unless you "save for previous (2020 or below)".

0 Kudos
Message 6 of 7
(34 Views)

 


@idrisozel wrote:

I have attached my current UDP reading structure. I have also added the UDP message. I tested it with the firewall closed. I can read from the source port (62000) and destination port (56200) on another device. However, I cannot read when the two port values ​​are the same.


Nobody "reads" from a source port.  That's just a field in the UDP header. Source and destination ports are completely independent. All you need to do is listen on the destination port of the incoming packet.

 

What are the exact error messages if you stop (not abort!) the VI? Why not place error indicators after each function for debugging? Flying blind is not useful.

 

OK, I looked at your code

 

As a start, read the posts in this thread.

 

(It is really annoying if the front panel and diagram are maximized to the screen. Please don't! Nobody like to stare at mostly whitespace while being prevented from looking at the help or this forum discussion at the same time!)

0 Kudos
Message 7 of 7
(21 Views)