Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-22
17:19 • Ticket [219237ffff] Inconsistent socket error messages between NT and UNIX s... artifact: 38c4e0d636 user: serhiy.storchaka
2026-10-21
10:03 • Closed ticket [219237ffff]. artifact: c01abf6c1b user: serhiy.storchaka
2003-04-23
03:57 • Ticket [219237ffff]: 4 changes artifact: bb8aa99e0a user: davygrvy
03:55 • Ticket [219237ffff]: 4 changes artifact: 9f1462d774 user: davygrvy
03:55 • Add attachment patch.txt to ticket [219237ffff] artifact: ba23d513b4 user: davygrvy
2001-09-14
06:41 • Ticket [219237ffff] Inconsistent socket error messages between NT and UNIX s... artifact: a43f9db3d8 user: andreas_kupries
2001-09-08
06:51 • Ticket [219237ffff]: 5 changes artifact: 31fb804118 user: davygrvy
06:37 • Ticket [219237ffff]: 5 changes artifact: 99a0b50e56 user: andreas_kupries
2001-04-01
01:47 • Ticket [219237ffff]: 1 change artifact: c7e3017ecb user: dgp
2000-10-26
05:03 • New ticket [219237ffff]. artifact: c9b5a371cb user: nobody

Inconsistent socket error messages between NT and UNIX

Closed / Fixed219237ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 41 days ago
Descriptionplain2000-10-26 05:03:58
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
dgp Ticket [219237ffff]: 1 change [History diff]2001-04-01 01:47:32
andreas_kupriesplain2001-09-08 06:37:12
Logged In: YES 
user_id=75003

Is there something we can do here ?
Assign to me later.
davygrvyplain2001-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.
andreas_kupries Ticket [219237ffff]: 1 change [History diff]2001-09-14 06:41:40
davygrvyplain2003-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...
davygrvyplain2003-04-23 03:57:24
Logged In: YES 
user_id=7549

Notice how WSAHOST_NOT_FOUND is ignored and 
becomes "invalid argument"!
serhiy.storchakawiki2026-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).

serhiy.storchaka Ticket [219237ffff]: 3 changes [History diff]2026-10-22 17:19:31
Log in (anonymous is fine) to add a comment.

Attachments: