Skip to content

CLOSE frame doesn't arrive, how to get close code and close reason? #32

Answered by tarasko
River-Shi asked this question in Q&A
Discussion options

You must be logged in to vote

If you didn't receive a "close" frame from the server there is no easy way to know why the server decided to disconnect you. If you still need some code you can assume WSCloseCode.NO_INFO or ABNORMAL_CLOSURE

picows doesn't try to hold back frames, as soon as it received a complete frame it passes it to the user code immediately.

What could possibly have happened:

  1. The server doesn't run a code to send a "close" frame before closing socket and terminating TCP connection.
    This typically happens when the server stops abruptly like crash or some kind of forcible stop by admin.
    It is also a very often case that server developers don't care about sending "close" frames even on the normal path.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tarasko
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #31 on December 17, 2024 13:23.