Click here to Skip to main content
15,899,124 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm trying to create a Tcp Socket that supports listening to an IPv4 as an IPv6 adress. I am using the following code.

C#
_listener = new TcpListener(IPAddress.Any, port);
_listener.AllowNatTraversal(true);                      
_listener.Start();


When I execute this code on a Windows Server 2003 SP2 this results in an SocketException with the following exception message: "An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call"

does anyone can explain what is going on?
Posted

1 solution

I haven't tried any IPv6 stuff yet, bu I believe you may have to start a second listener if you want to support both IPv4 and IPv6. IPAddress.Any is specific to IPv4. The IPv6 equivilent is IPAddress.IPv6Any.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900