Consider adding an exercise on reusing sockets
See original GitHub issueOn Downloading Web Pages, there is a “Go further” section on supporting redirects. One of the things that becomes “obvious” if you know about the handshake process is that closing and opening a socket is kind of wasteful.
Once you support HTTP 1.1, it seems like you should be able to reuse the socket by not immediately closing it, and then requesting the Location
of a redirect. Would that be a useful exercise for readers, or is that just an “obvious” thing that you already expect readers to do?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
what is benefit from socket reuse in C# - Stack Overflow
In unmanaged code you would use DisconnectEx() to reuse a socket for an subsequent AcceptEx() or ConnectEx() call, more likely the former.
Read more >Does having a load balancer allow you to re-use socket ...
This feature enables load-balancers to re-use TCP connections on the server-side and greatly improves the performance of the web application on the back-end....
Read more >Reuse Socket - We're Listening... - Unitronics Support Forum
Hi everyone! I´m using the four sockets in a Vision 130, and I need more! So, I tried to redifine a socket in...
Read more >Do unix domain sockets support reuse? - Unix Stack Exchange
I suspect a lot of it is just outdated, but I'm no expert. Do I ProxySet enablereuse=on if my handler is a socket?...
Read more >asyncio.StreamReader.read hangs for reused socket file ...
When the reuse happens, the new socket's fd (which is the same as the old fd) is added to the selector by calling...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ooh, I’ll look into this. In reality we need to self-host all of our examples and exercises, because things like this change!
You don’t need
keep-alive
in HTTP/1.1, it’s the default (this is in fact why this book uses 1.0). Implementing “keep-alive” is a good exercise, and I think I drafted one at some point. I didn’t think of using it for redirects though, that’s a good idea. Perhaps I’ll have something like this in a later chapter, once we’re requesting CSS or JS.