SuperSocket.ClientEngine | NET library which can make your socket client | Socket library
kandi X-RAY | SuperSocket.ClientEngine Summary
kandi X-RAY | SuperSocket.ClientEngine Summary
SuperSocket.ClientEngine is a .NET library for socket client rapid development. It provides easy to use and efficient APIs to simplify your socket development work about asynchronous connecting, data sending, data receiving, network protocol analysising and transfer layer encryption.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SuperSocket.ClientEngine
SuperSocket.ClientEngine Key Features
SuperSocket.ClientEngine Examples and Code Snippets
Community Discussions
Trending Discussions on SuperSocket.ClientEngine
QUESTION
I am really having a headache with this weird "issue" with websockets, I am returning to programming from a pause of 10 years and I am learning websockets for the first time, so I must be doing something wrong.
I made a simple code in C# to open a websocket connection and receive messages (Book order updates) from Binance Websocket API, I followed their guidelines like sending a subscribe message in JSON format to be able to receive the messages.
And it works... BUT only if I put a Console.Write("")
in the while loop below, if I don't it just stays in OPEN state and never exits the loop, standing there forever, the command Console.WriteLine("after loop")
is never printed. I put this loop to wait the websocket to connect to the server (State from Connecting to Open).
If you see the code below, With the Console.Write("")
commented the loop is never exited and the websocket messages are never received, uncomment it and everything will work fine.
I attached 2 images showing the output in Console, also tried to take out the "using" statement and put an infinite loop instead of Console.ReadKey();
. But nothing seems to work, only if I uncomment the write command inside the loop, what I think it's bizarre...
Why is this? What am I doing wrong?
...ANSWER
Answered 2020-May-03 at 09:15I was able to reproduce this behavior only in Release
mode and I would say that it seems to be compiler+JIT issue.
Here disassembly(can be viewed in VS Debug -> Windows -> Disassembly) code which is generated for non-loop:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SuperSocket.ClientEngine
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page