-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
- Open an TCP server on some local port of the IPv4 loopback interface. For example, with Python 3 run a simple HTTP server with
python -m http.server --bind 127.0.0.1 8000. - In another terminal, run
Test-Connection localhost -TcpPort 8000.
Expected behavior
The command returns True.
Actual behavior
The command returns False.
If we run Test-Connection 127.0.0.1 -TcpPort 8000 or Test-Connection localhost -IPv4 -TcpPort 8000, the returned result is True. The command Test-NetConnection localhost -Port 8000 does give the correct answer, although it first tries connecting to ::1 : 8000 and fails.
Error details
It seems Test-Connection is just testing the first loopback address it is finding, which is the IPv6 ::1 address. I think this behaviour is surprising, especially since locally deployed servers are most frequently bound to 127.0.0.1 only.
Environment data
Name Value
---- -----
PSVersion 7.2.4
PSEdition Core
GitCommitId 7.2.4
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module