Jump to content

receiving UDP datagrams


Recommended Posts

Hi

I am trying to implement a way in which I am able to know the IP of the host from my PC(both are connected directly to one another via ethernet). My host is transmitting periodically its info such as MAC n IP address. The destination port is 11000(I guess that this is the client(PC)). However, when I tried receiving data from my PC in this port using the UDP receiver example provided in LV 8.6, I don't get anything(It is blank all the time). Changing the time to -1 doesn't helps either. I am pretty sure that the host is using UDP to transmit its data because I am able to capture the datagrams in a program called Wireshark, Network protocol analyzer. Please help. I struck with this problem for a few days.

Thank you.

Link to comment

QUOTE (austin316 @ Feb 16 2009, 02:08 AM)

Hi

I am trying to implement a way in which I am able to know the IP of the host from my PC(both are connected directly to one another via ethernet). My host is transmitting periodically its info such as MAC n IP address. The destination port is 11000(I guess that this is the client(PC)). However, when I tried receiving data from my PC in this port using the UDP receiver example provided in LV 8.6, I don't get anything(It is blank all the time). Changing the time to -1 doesn't helps either. I am pretty sure that the host is using UDP to transmit its data because I am able to capture the datagrams in a program called Wireshark, Network protocol analyzer. Please help. I struck with this problem for a few days.

Thank you.

If the host is using adressed UDP datagrams in contrast to broadcasts, only the adressee will receive the datagram. What destination address do you see in Wireshark?

Note that Wireshark uses promiscious mode to receive any datagrams and TCP packets on the network interface. This is a mode that can not be used by a regular sockets as used by LabVIEW and just about any other network software but only by tapping directly into the card driver through a filter driver. In Wireshark they use the WinPcap driver for this.

Rolf Kalbermatter

Link to comment

QUOTE (rolfk @ Feb 16 2009, 05:01 PM)

If the host is using adressed UDP datagrams in contrast to broadcasts, only the adressee will receive the datagram. What destination address do you see in Wireshark?

Note that Wireshark uses promiscious mode to receive any datagrams and TCP packets on the network interface. This is a mode that can not be used by a regular sockets as used by LabVIEW and just about any other network software but only by tapping directly into the card driver through a filter driver. In Wireshark they use the WinPcap driver for this.

Rolf Kalbermatter

Thanks for the reply. I manage to solve the said issue. I need to use UDP multicast open to solve the problem.

Another issue, how do I programmatically set the computer IP(windows) using Labview. Thank you

Link to comment

You should be careful changing the IP address of your PC programmatically. Is you are not careful this can cause you lots of networking headaches. If you are on an isolated, controlled and self contained network you could do this. If you are running on a large network, such as your company's network, I recommend you contact your IT staff regarding your IP addressing needs. Network addresses are managed for a reason. The last thing you want to do is create duplicate addresses on a network.

Link to comment

QUOTE (Mark Yedinak @ Feb 17 2009, 12:31 AM)

You should be careful changing the IP address of your PC programmatically. Is you are not careful this can cause you lots of networking headaches. If you are on an isolated, controlled and self contained network you could do this. If you are running on a large network, such as your company's network, I recommend you contact your IT staff regarding your IP addressing needs. Network addresses are managed for a reason. The last thing you want to do is create duplicate addresses on a network.

I am only doing it in my personal pc. So there won't be any problems. I am trying to eliminate the process of manually setting the IP. Any help in setting the IP programmatically would be appreciated. thank you.

Link to comment

QUOTE (austin316 @ Feb 20 2009, 10:03 AM)

I am only doing it in my personal pc. So there won't be any problems. I am trying to eliminate the process of manually setting the IP. Any help in setting the IP programmatically would be appreciated. thank you.

I would look to see if there are some .NET or windsock dll calls that you can make. I am not aware of any way to do it using LabVIEW primitives.

Link to comment

QUOTE (Mark Yedinak @ Feb 20 2009, 11:24 AM)

I would look to see if there are some .NET or windsock dll calls that you can make. I am not aware of any way to do it using LabVIEW primitives.

LabVIEW offers no such access for sure. You could try to use netsh command line tool available in 32 Bit Windows installations.

something like this executed with System Exec should work:

netsh interface ip set address "Local Area Connection" static <local address> <subnet> <gateway> 1

netsh interface ip set dns "Local Area Connection" static <dns server address> primary

netsh interface ip delete dns "Local Area Connection" all

netsh interface ip set address "Local Area Connection" dhcp

netsh interface ip set dns "Local Area Connection" dhcp

Local Area Connection is the name of your network interface as Visible in the Network Connections.

Rolf Kalbermatter

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.