Take the 2-minute tour ×

What I thought would be a simple task, has turned into a bit of a nightmare.

What it boils down to now, is I need to create a UDP listener on port 8888, on a specific link local IPv6 address.

I get an exception thrown when the following line is executed:

_udpSoc = new UdpClient(MONITOR_INPUT_EVENT_SOCKET, AddressFamily.InterNetworkV6);

(where MONITOR_INPUT_EVENT_SOCKET is a const int of value 8888)

Having tried to look for support, I even find an MSDN article describing exactly the same line.

The SocketException thrown is "The requested address is not valid in its context" with an ErrorCode of 10049 with a stacktrace of:

at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.UdpClient..ctor(Int32 port, AddressFamily family)
at [my code...]

Alternatively, if I change the problem line to:

_udpSoc = new UdpClient(_groupEp);

(where _groupEp is an IPEndPoint set to IPAddress.Any, with the ScopeId set the the correct interface, and port of MONITOR_INPUT_EVENT_SOCKET)

...and get an exception of "The requested address is not valid in its context", with the same ErrorCode and stack trace as before.

What's going wrong?

share|improve this question
Just to add, if I remove the ScopeId (set to 0, default value), the UdpClient is created but does not receive the data (which can be seen on wireshark) –  l33tmike Jul 17 '13 at 16:04
Socket.OSSupportsIPv6 is true? (this value reflects some .net configuration as well) –  Alex K. Jul 17 '13 at 16:11
10049 really suggests you don't have IPv6 on your computer. Using UdpClient(IPEndPoint) as you described sounds like it's using IPv4 –  Peter Ritchie Jul 17 '13 at 18:50
I definitely have IPv6 support - I have an active telnet session over IPv6 (link local) to the target in the same application. –  l33tmike Jul 18 '13 at 7:31
I would still check it as OSSupportsIPv6 also reflects whether IPV6 is enabled in the current .net system.net config –  Alex K. Jul 18 '13 at 10:02
show 2 more comments


Your Answer



Browse other questions tagged or ask your own question.