question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider adding an exercise on reusing sockets

See original GitHub issue

On 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:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
pavpanchekhacommented, May 10, 2021

Ooh, I’ll look into this. In reality we need to self-host all of our examples and exercises, because things like this change!

1reaction
pavpanchekhacommented, Apr 9, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found