Can't connect to anything - System.Net.Sockets.SocketException
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 32/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- networking
Research direction
Start at WebSocket.setClientStream() and WebSocket.connect(), using the stack trace and TcpClient constructor as entry points. Compare this path with the working System.Net.WebSockets ClientWebSocket case described in the report, then reproduce against ws://localhost:4444/. Done means identifying and correcting the websocket-sharp connection failure without regressing normal connections.
Written by the indexing model from the issue text.
Description
I feel like there is a simple explanation and I'm doing something dumb here. But I'm just trying to setup a basic ws connection, my code looks like:
using (var ws = new WebSocket("ws://localhost:4444/"))
{
ws.Log.Level = LogLevel.Trace;
ws.OnMessage += (sender, e) => Console.WriteLine("ws says: " + e.Data);
ws.Connect();
}
The output I get is:
3/31/2022 4:00:45 PM|Warn |Logger.set_Level|The current logging level has been changed to Trace.
3/31/2022 4:00:45 PM|Fatal|WebSocket.connect|The operation completed successfully.
3/31/2022 4:00:45 PM|Debug|WebSocket.connect|System.Net.Sockets.SocketException (0x80004005): The operation completed successfully.
at System.Net.Sockets.TcpClient..ctor (System.String hostname, System.Int32 port) [0x0006d] in <5307bcb359e140d4b454b70b3ff646a0>:0
at WebSocketSharp.WebSocket.setClientStream () [0x00066] in <c17dee5c18474d2096de0e4fb891b68d>:0
at WebSocketSharp.WebSocket.doHandshake () [0x00001] in <c17dee5c18474d2096de0e4fb891b68d>:0
at WebSocketSharp.WebSocket.connect () [0x000fa] in <c17dee5c18474d2096de0e4fb891b68d>:0
3/31/2022 4:00:45 PM|Trace|WebSocket.close|Begin closing the connection.
3/31/2022 4:00:45 PM|Debug|WebSocket.closeHandshake|Was clean?: False
sent: False
received: False
3/31/2022 4:00:45 PM|Trace|WebSocket.close|End closing the connection.
Disconnected to websocket server.
I can connect to it fine with the same address using basic System.Net.WebSockets library and the ClientWebSocket class. But websocket-sharp just gives that error and bails out no matter what I seem to change.
- Dominant language
- C#
- Stars
- 6.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sta/websocket-sharp
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
sta/websocket-sharp#201 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
sta/websocket-sharp#762 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
sta/websocket-sharp#761 ·
-
Bad handling of sending stream makes lib not RFC compatible and KeepClean useless in some cases. Open
Difficulty 4/5 3-5 days Newbie friendliness 42/100
sta/websocket-sharp#760 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sta/websocket-sharp#759 ·
All issues in sta/websocket-sharp
Similar issues
-
bug documentation frontend
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
azurenoops/spin_agent#975 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100