LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Transmission via Ad Hoc Network in LabVIEW

Solved!
Go to solution

Hi,

 

I'm trying to transmit some data (position, velocity, and etc) from a laptop to a host computer.

Both the laptop and the desktop have wireless card installed so I thought it would be a good

idea to transmit the data via Wi-Fi using TCP.

 

However, the problem is that there is no router/modem in the area where the laptop is sitting

so I create an Ad hoc (computer-to-computer) network between the laptop and the desktop.

 

Then, I use "ipconfig /all" in Windows command prompt to extract the ip address as follows.

Laptop Wireless IP Address: 169.254.165.72

Desktop Wireless IP Address: 169.254.102.126

Desktop Ethernet IP Address: 129.94.229.230

 

I then use the example code in TCP library named "Data Server.vi" and "Data Client.vi."

I listen to port 6340 on both the wireless and ethernet card of the desktop on the server side.

And on the client side, I open a connection to port 6340 of the IP address 169.254.102.126.

However, the connection cannot be made. Does anyone know why this is the case?

 

Note: I have disabled all the firewalls.

 

Interesting enough, when 2 computers are connected to the same modem, their IP addresses

differ only by the last number (e.g. XXX.XXX.XXX.123 vs XXX.XXX.XXX.256) but when an Ad

hoc network is established, their IP addresses have 2 numbers which are different. (XXX.XXX.

102.126 vs XXX.XXX.165.72) I wonder if this has anything to do with the failure.

 

Thank you for any of your help.

Ron Liou

0 Kudos
Message 1 of 6
(3,337 Views)

It might. The value/setting you want to check with ipconfig /all is the netmask.

 

A netmask of 255.255.255.0 would prevent the two wireless network adapters from communicating at the TCP level. A change to 255.255.0.0 should fix it.

 

I'm a little confused / concerned about your xxx.xxx.xxx.256. I assume this is not the actual value; it should be a U8 (4 octets total) and the range would be 0 to 255. Don't use 0 or 255; these are reserved from broadcasting and routing. Also try to avoid .1 and .254 as these are usually reserved for gateway addresses.

 

 


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 6
(3,324 Views)

Thanks for your reply, Phillip.

 

Sorry about the confusion. Yes, the value 256 is not the actual value as I forgot what

the value was when I connected both computers to one modem.

 

I checked the subnet masks of the wireless connection for both computers. They both

have 255.255.0.0. Any idea of where the problem might be?

 

Great thanks for the help,

Ron Liou

0 Kudos
Message 3 of 6
(3,307 Views)
Solution
Accepted by topic author Ron Liou

I have somehow got this working.

 

What I did was

- again setting up Ad hoc network for the labtop and the desktop

 

- checking the ip address is still the same

              >> Laptop Wireless IP Address: 169.254.165.72

              >> Laptop Wireless Subnet Mask: 255.255.0.0

              >> Desktop Wireless IP Address: 169.254.102.126

              >> Desktop Wireless Subnet Mask: 255.255.0.0

 

- turning on the ICS of the ethernet card on the desktop

  (This resulted in different ip addresses beng assigned)

              >> Laptop Wireless IP Address: 192.168.137.21

              >> Laptop Wireless Subnet Mask: 255.255.255.0

              >> Desktop Wireless IP Address: 192.168.137.1

              >> Desktop Wireless Subnet Mask: 255.255.255.0

 

Now I use the desktop ip address (192.168.137.1) to open the connection

and it just works!!!??

 

I am quite happy with the fact that it is working but I would appreciate an

explanation on why an ICS is required.

 

Thanks!

0 Kudos
Message 4 of 6
(3,286 Views)

Depending on your Windows version and anti-virus settings, your desktop may have been blocking the TCP port number(s) you were trying to use (for security purposes).

 

Enabling ICS may have unblocked the port(s) to allow them to be routed through the desktop to the network at large.


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 5 of 6
(3,259 Views)

Thanks for the explanation.

 

So you mean apart from the firewall, Windows has a anti-virus setting which might

have blocked a particular TCP ports? How would that help prevent the virus?

 

0 Kudos
Message 6 of 6
(3,234 Views)