Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 2: time_server.c #20

Open
IstiCusi opened this issue Aug 28, 2022 · 2 comments
Open

Chapter 2: time_server.c #20

IstiCusi opened this issue Aug 28, 2022 · 2 comments

Comments

@IstiCusi
Copy link

IstiCusi commented Aug 28, 2022

Hi codeplea,

I realized the following behavior: The server closes after connection of the client browser. Closing the browser on the local maschine
leads to the strange state, that the server cannot bind to the 8080 port. This I observed on my local Debian machines.
Is there maybe something not released in the example code. After some time the binding is again possible. I think this is reasoned by TIME_WAIT for old packages. But it needs really minutes that the 8080 port is available again. Is there a way
to programmatically avoid this wait cycle. Maybe to early asked -- started the book reading some minutes ago.

Thanks for info, Stephan

@codeplea
Copy link
Owner

Hi Stephan,

Have you read the sections in the book called "Connection tear-down", "The shutdown() function", and "Preventing address-in-use errors" starting on page 378 and? It sounds like a TIME-WAIT issue. You can diagnose with netstat -na. If that is indeed the issue, then the simple fix is to use the SO_REUSEADDR flag.

@IstiCusi
Copy link
Author

IstiCusi commented Aug 30, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants