LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW TCP communication fails to connect under WIFI connection

Solved!
Go to solution

Background

I need to run a data acquisition program and a closed loop control program separately on two laptops. To improve the communication speed, I plan to use TCP/IP communication to realize data transmission between two laptops.

To meet the requirement of no cable connection between the two laptops, I connected the two laptops to the same WIFI signal to realize TCP/IP communication.

Trouble

I tested the TCP/IP communication demo code of Labview 2016 through a network cable connection and a WIFI connection.

Network cable connection:

The TCP/IP communication demo code runs normally, and the data communication between the two laptops is normal.

WIFI connection

The TCP/IP communication demo code cannot runs. The Error Reporting of client program is network timeout.

But, It is detected that the two laptops are connected through the ping command, and the network delay is less than 10ms.

Phenomenon 1: There is a small probability that the TCP/IP communication program can run normally, but the data delay in labview exceeds the network delay.

Phenomenon 2:The host program sets the TCP monitoring to never time out, but when the client program times out and stops running, the host program also stops running.

 

So I would like to know why the TCP/IP communication between two laptops cannot be realized in Labview when two laptops connected via WIFI.

 

software settings and hardware configuration

Host PC :    CPU: i5 11320H, OS version: windows 11. 

Client PC :    CPU: i5 8500u, OS version: windows 10. 

wireless router settings:DHCP Server: Automatic. IP address and MAC address binding. The wireless router does not connect to the Internet, only the local area network.

Host PC network settings:IPV4 network attribute is to obtain IP address automatically.  IP address:192.168.1.100

Client PC network settings:IPV4 network attribute is to obtain IP address automatically.  IP address:192.168.1.101

 

If you have any details you need to know, please feel free to leave a message. I desperately need your help.

0 Kudos
Message 1 of 11
(2,036 Views)
Solution
Accepted by topic author REDJ

I don't think this is a LabVIEW issue, as LV doesn't know the adapter type it is communicating through. LV uses the OS's TCP/IP functions to communicate and it is the OS that knows about the network adapter.

 

Your issue looks more like a networking issue as some ports are blocked on WiFi networks for security reasons whereas wired networks are not as an intruder cannot easily get access to a wired network compared to a wireless network.

 

You might need to consult with your IT team to understand what is different between your wired network and wireless one.

 

Edit : Just re-read your post, you mention that this is a separate WiFi AP that does not connect to internet, in any case, I would still suspect the network/firewall settings for the WiFi blocking LV TCP/IP access.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 11
(2,014 Views)

So this would probably be DHCP doing its thing.  Different network adapters would get different IP addresses, and if your code depends on the IP addresses being consistent, it's not going to work.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 11
(2,009 Views)

Bill's guess is more logical than mine.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 11
(1,970 Views)

If you really want to improve speed, then use UDP instead, especially if you can afford losing some data from time to time. Actually, the probability to loose data on a local network is low in my opinion, unless the environment is very noisy. You may add a pseudo-timestamp to your packet to check if some data was dropped.

 

@Flora015: your link does not work for me.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 11
(1,938 Views)

Thank you for your reply, I found that setting the VI required in TCP/IP communication to never timeout (timeout=-1) can improves the success rate of communication via WIFI. Therefore, I also suspect that some settings in the WIFI AP cause the communication to fail. I am discussing the possible reasons with IT experts.

0 Kudos
Message 6 of 11
(1,923 Views)

Thank you for your reply. According to your suggestion, I check the IP address of the machine through the ipconfig command before running the TCP/IP program. And set the IP address and hardware MAC address binding in the WIFI AP to ensure that the IP address does not change during the running of the TCP/IP program.

0 Kudos
Message 7 of 11
(1,921 Views)

Thanks for your suggestion, data loss is acceptable, I will try to use UDP communication.

0 Kudos
Message 8 of 11
(1,905 Views)

@REDJ wrote:

Thank you for your reply. According to your suggestion, I check the IP address of the machine through the ipconfig command before running the TCP/IP program. And set the IP address and hardware MAC address binding in the WIFI AP to ensure that the IP address does not change during the running of the TCP/IP program.


Make sure to let us know what you find!  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 11
(1,916 Views)

Hello everyone, the problem I consulted has been resolved. The solution is to set the timeout period of all VIs in TCP communication to -1.

0 Kudos
Message 10 of 11
(1,844 Views)