WebSocket4Net icon indicating copy to clipboard operation
WebSocket4Net copied to clipboard

SocketException: The requested name is valid, but no data of the requested type was found

Open brako opened this issue 1 year ago • 1 comments

The bug

Hi! When I try to connect with the client on my local server everything works fine, but when I use my cloud environment I have the following error:

TestSocket: Failed to connect to Unspecified/some.domain.com:443
System.Net.Sockets.SocketException (11004): The requested name is valid, but no data of the requested type was found.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
   at SuperSocket.Client.SocketConnector.ConnectAsync(EndPoint remoteEndPoint, ConnectState state, CancellationToken cancellationToken)

Library version

v1.0.0-beta.5

Reproduction Steps


using WebSocket = WebSocket4Net.WebSocket;

var ws = new WebSocket("wss://some.domain.com/");
ws.Headers.Add("Sec-WebSocket-Extensions", "permessage-deflate; client_max_window_bits");

//Throws the exception here
await ws.OpenAsync(cancellationToken).ConfigureAwait(false);

Additional Information

If I use ws://localhost:8080 instead, the issue is not happening.

Looks like it may be related to a DNS lookup issue, but I am not sure why since the native websocket is able to connect without issue.

brako avatar Jan 09 '25 17:01 brako

I have the same problem.

libu1129 avatar Jun 25 '25 23:06 libu1129