Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5362

Network Cable Unplugged Status, PC to PLC

$
0
0

I am working with a PLC connected to the PC via Ethernet.  I would like to receive notification that the cable is unplugged.  Here is the scenario:

 

1) Connect to PLC with ConnectToTCPServer (ok).

2) Send commands via ClientTCPWrite (ok).

3) Receive status back from PLC. (ok)

 

All this works great.

 

Now unplug the Ethernet cable.  Go to step 2) and send the command.  CVI sends it and returns a -kTCP_NoError.  The PLC never responds, and the system is frozen.

 

Why do I not get an error when using ClientTCPWrite to an open/broken connection?

 

Obviously, Windows is aware of the connection, as I instantly get a "Network Cable Unplugged" notice in the taskbar.  Is there an SDK function to do this?

 

If you wait long enough, it will trigger the TCP_DISCONNECT in the callback.

 

Thanks in advance, David


Viewing all articles
Browse latest Browse all 5362

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>