LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 66 - TCP/IP

Solved!
Go to solution

Hello,

 

there is an error by using TCP/IP write block.

Application is connected with local printer, using IP address, actually, only this PC has connected to the printer.

Communication works normally, i can print, and then, with no reason, error 66 occurs.

milan87_0-1675925722731.png

 

(Hex 0x42) The network connection was closed by the peer. If you are using the Open VI Reference function on a remote VI Server connection, verify that the machine is allowed access by selecting Tools>>Options>>VI Server on the server side.

 

But because there is no other device communicate with this printer, there is no chance that other device took over communication.

Can someone advice how to solve this issue.

 

Thanks.

0 Kudos
Message 1 of 4
(2,816 Views)
Solution
Accepted by topic author milan87

Hi milan,

 


@milan87 wrote:

Can someone advice how to solve this issue.


I had a similar problem with a Modbus/TCP device: some devices monitor their TCP communication and when no new messages arive within a given timeout they close the TCP connection. In such cases you can encounter error 66...

 

Does your printer has such a timeout setting? (Does its manual mention something like that?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,807 Views)

If it is HTTP traffic the server will by default always close the connection after it responded unless there is a Keep-Alive header field.

 

Other protocols do similar fhings. Reopening a connection costs time but if the interface is not used for frequent data transmissions that is not very significant. Always closing and reopening the connection is however a lot easier as the client and server don’t have to monitor the socket status to see if the connection may have dropped out and then force a reconnect anyhow.

 

Basically even if your printer protocol doesn’t say that it will close the connection you have to be prepared for it anyways if you want stable communication. In TCP communication an error doesn’t mean the device exploded and you can’t communicate with it anymore. It simple means that somehow the connection failed, dropped out or was forcefully closed and you should close your end of the connection and attempt a reconnect.

 

There are only two exceptions to this:

 

1) error when trying to open a connection, try again or abandon the attempt

 

2) timeout error when trying to read, try again to read with the same or a different timeout until you have to consider that the server either died, the cable got cut or the world has stopped to exist. Any other error than timeout means the same as an error elsewhere: close the connection and try to open it again!

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 4
(2,785 Views)

Hi GerdW,

 

yes, you have right. Printer was set for 300s timeout. Now timeout checking is disabled.

 

Thanks a lot.

 

0 Kudos
Message 4 of 4
(2,761 Views)