cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

TCP Error Codes 62-66

TCP Error Codes 62-66

Regarding TCP connections, can someone explain the difference between Error 62 (Connection Aborted) and Error 66 (Connection Closed)?

 

My GUESS is that 66 means this Conn ID was closed normally via program operation and 62 means some unexpected breakage occurred (wire cut, power loss, etc).

 

Is that a correct guess?

 

If so, then 66 could only occur if I try to use a ConnID after I have closed it.

 

Also,

 

Error 63(Connection refused) means that an attempt to connect was refused by the other end, and so it could only occur on a TCP CONNECT operation, correct?

 

Error 64 (Not Connected) - where could that happen? If I pass NIL for CONN ID, it should report Error 1(BAD PARAMETER), if I pass a once-valid-but-now-closed ConnID, I would expect Error 66 (Connection Closed), if I pass a random ConnID number, I would expect Error 1.  So when does 64 happen?

 

Thanks for pointers to docs, or other insights.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 6
(9,761 Views)

Re: TCP Error Codes 62-66

This knowledgebase entry might shed some light on why/when error 66 occurs...

 

http://digital.ni.com/public.nsf/allkb/D90C4F99C1EF3F6A86256E4A0080A120

 


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
(9,757 Views)

Re: TCP Error Codes 62-66

You may be oversimplifying.  Either end of a connection can close the connection, so you could get error 66 if the remote side closes the connection cleanly even if your code has not yet done so.  Some of those errors may occur with UDP but not TCP.  You could consult the full list of Windows Sockets Error Codes, which has a slightly more detailed list of errors and explanations, although those codes may not map directly to the LabVIEW ones.  The explanation for "Not Connected" says, "

Socket is not connected.

A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied. Any other type of operation might also return this error—for example, setsockopt setting SO_KEEPALIVE if the connection has been reset."

0 Kudos
Message 3 of 6
(9,746 Views)

Re: TCP Error Codes 62-66

Either end of a connection can close the connection, so you could get error 66 if the remote side closes the connection cleanly even if your code has not yet done so. 

 

OK, I plan to close my end on any error 62, 63, 64, 66.

But if error 66 means "somebody, on one end or the other, closed this connection", does 62 mean "wire broke, power fail, etc". ?

 

I'm guessing (I don't know the innards) that when you close the connection programmatically, a signal is sent down the line to the other end "Hey, I'm closing this, goodbye", and hangs up, leading to error 66 if you try something else on that ConnID.

 

But if somebody just pulls the plug out, there is no such handshake, and you get Error 62.

 

Is that a fair guess?


Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 6
(9,742 Views)

Re: TCP Error Codes 62-66

The reason for various error codes is not as well-defined as you'd like.  See, for example, "Error 62 and Error 66 in the TCP Examples under Windows NT," "The NT OS will return error 62 or 66, depending on the state of the TCP connection when the next write call is made."

0 Kudos
Message 5 of 6
(9,740 Views)

Re: TCP Error Codes 62-66

OK, so the full definition of 66 is "Closed by the PEER (the other end)".

 

Though it looks like I can't reliably determine whether the other end closed the connection politely, or somebody pulled the plug.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 6
(9,738 Views)