Tcl Source Code

View Ticket
Login
Ticket UUID: 219237
Title: Inconsistent socket error messages between NT and UNIX
Type: Bug Created on: 2000-10-26 05:03:58
Submitter: nobody Assigned to: andreas_kupries
Subsystem: 27. Channel Types Severity:
Priority: 3 Low Last modified: 2026-10-22 17:19:31
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-10-21 10:03:37
Version: obsolete: 8.3
Description:
OriginalBugID: 4754 Bug
Version: 8.3
SubmitDate: '2000-03-30'
LastModified: '2000-03-31'
Severity: MED
Status: Assigned
Submitter: sandeep
ChangedBy: ericm
OS: All
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'


Steps to reproduce:
1.  socket donexist.com 80

Expected Result:
"couldn't open socket: host is unreachable" error

Actual Result:
On Linux and Solaris, you get the expected result.
On NT, you get "couldn't open socket: invalid argument"

At the least, the error messages should be consistent.

In tclUnixChan.c it looks like it is returning EHOSTUNREACH (and that is supported by the error message printed).  On Windows it looks like it is too, but clearly it's not.  Somebody else must be setting errno.

- eric

-- 03/31/2000 ericm
User Comments:
andreas_kupries added on 2001-09-08 06:37:12:
Logged In: YES 
user_id=75003

Is there something we can do here ?
Assign to me later.

davygrvy added on 2001-09-08 06:51:20:
Logged In: YES 
user_id=7549

I can't look at this right now.

If I had the time, it looks easy though.

davygrvy added on 2003-04-23 03:55:17:

File Added - 48448: patch.txt

Logged In: YES 
user_id=7549

generally speaking, winsock error messages are discarded in 
favor of their posix translation.  The trouble is, any non 
translatable error code becomes EINVAL...  shame on Tcl for 
this loss of info...

davygrvy added on 2003-04-23 03:57:24:
Logged In: YES 
user_id=7549

Notice how WSAHOST_NOT_FOUND is ignored and 
becomes "invalid argument"!

serhiy.storchaka added on 2026-10-21 10:03:37:

Since 8.6.0 (TIP #162, [3f8b48b6b6]) both platforms resolve host names with getaddrinfo() and report the resolver's own message. On Windows an unknown host now gives "couldn't open socket: No such host is known." instead of "invalid argument" (checked with 8.6.18, 9.0.5 and 9.1).


Attachments: