Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Net.Sockets.TcpClient constructor not handling IPv4-Mapped Addresses correctly #1214

Closed
agowa opened this issue Jun 6, 2020 · 1 comment

Comments

@agowa
Copy link

agowa commented Jun 6, 2020

The System.Net.Sockets.TcpClient constructor fails to handle IPv4-Mapped Addresses correctly.
However the Connect function does.

I've tried this with Powershell 7.0.1 and .Net Core 3.1.4

Not working example:

PS C:\> $tcpConnection = [System.Net.Sockets.TcpClient]::new("::ffff:c163:9050", 443)
MethodInvocationException: Exception calling ".ctor" with "2" argument(s): "The requested address is not valid in its context. [::ffff:193.99.144.80]:443"

Working example:

PS C:\> $tcpConnection = [System.Net.Sockets.TcpClient]::new()
PS C:\> $tcpConnection.Connect("::ffff:c163:9050", 443)
PS C:\> $tcpConnection.Connected
True

Version information:

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.0.1
PSEdition                      Core
GitCommitId                    7.0.1
OS                             Microsoft Windows 10.0.19631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS C:\> [Environment]::Version

Major  Minor  Build  Revision
-----  -----  -----  --------
3      1      4      -1

Related RFC: https://tools.ietf.org/html/rfc4038#section-4.2

@agowa agowa changed the title System.Net.Sockets.TcpClient constructor not handling IPv4 mappe addresses correctly System.Net.Sockets.TcpClient constructor not handling IPv4-Mapped Addresses correctly Jun 6, 2020
@leecow
Copy link
Member

leecow commented Jan 5, 2021

This repo is no longer actively monitored. Closing up old issues that have not had activity in while. If this is still an issue, please open a new issue in an appropriate repo listed in microsoft/dotnet#1275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants