LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I sometimes get Error 42 when opening a TCP connection - how can I fix this ?

In my Labview application I am opening a TCP connection in an identical way to the Data Client example. I am using a direct connection to external equipment using an ethernet crossover cable. The error occurs on at least 2 different PCs.
The error can occur regardless of whether anything is connected to the ethernet port of the PC.
The only way I have found to clear the error is to power down the PC and restart with a connection to the office LAN. Then I can swap back to the crossover cable and talk to the remote equipment once again, ...unitl the next time the error occurs.
I have LabView 6.0 running on Win98.
Any help greatly appreciated.
0 Kudos
Message 1 of 5
(5,343 Views)

You need to run your code in high light execution mode to see exactly what VI generates the error. It is the light bulb on the block diagram's menu bar.

I found one hit for the error 42. I do not know if it helps.

How Can I Open a TCP/IP Connection Via a Proxy Server? 

0 Kudos
Message 2 of 5
(5,343 Views)
Jeremy,
Thanks for taking the time to answer
I already checked the link you suggested but I am connecting to my remote instrument with a 2m cross-over cable.
I Have looked into this a little further, it seems the sequence of events is as follows -
1. After some hours the connection gets lost.
2. TCP Read returns error 66 - Connection was closed by peer.
3. If I try to restart my program I get Error 42 at TCP open Connection.
4. Rebooting the PC doesn't clear the error 42 problem.
5. If I try to PING my instument I get "Host unreachable".
6. I have to "refresh" my network card by connecting to our LAN and either opening a file on another PC or simply sending a PING to another PC.
6. I can then reconnect my remote instrument via cross-over cable
and we're up and running for another few hours.

I get the same problem on two different PCs with different NICs and different OS (Win98 and WinME)
I am assuming that because a reboot has no effect that its not a memory allocation problem.
It seems like LabView stops talking to the NIC and then gets locked out some how.


Any other tips ?
0 Kudos
Message 3 of 5
(5,343 Views)
I fixed this myself but I'll post the answer to help anyone else with the same problem.

Error 66 can occur at TCP read if the Data Client or Data server unexpectedly changes its IP address. This occurred with my Data client's IP address which it normally aquires from a DHCP server. However whilst connected to the Data server via an ethernet crossover cable it cannot refresh its IP address and after a timeout period of a few hours it reverts to a default IP address. This gives Error 66 at TCP read.

When I tried to reconnect with TCP open connection the Data Client was now on a different subnet. This causes Error 42.

The problem was overcome simply by giving the Data client a fixed IP address, the Data server already had a fixed IP address.
Message 4 of 5
(5,343 Views)
THank you Kevin!

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 5
(5,343 Views)