Socket support and keep alive connection

Does every webbrowser support sockets? If not, how do I detect this when the client connects? And is it possible to reiceive a request if the client doesn't support sockets?

I also wonder... When using sockets, how do I keep a connection alive after the client has received everything that was requested? At the moment the client disconnects when it's satisfied. (Received all webcontent + favicon)

https://en.wikipedia.org/wiki/Network_socket
The socket is the lowest level primitive that allows two remote machines to talk to one another. In an abstract sense, all you need are some wires and switches to generate the right sequence of on/off pulses, but any practical implementation is going to use OS provided sockets.

Also, it's hard to tell at the server end whether the client is
- an actual browser like firefox or chrome
- a command line tool like curl or wget
- a simple program implementing the basics of https://tools.ietf.org/html/rfc7230 (through to 7235)

> how do I keep a connection alive after the client has received everything that was requested?
Keepalive is something clients do, not servers.

> At the moment the client disconnects when it's satisfied.
You said it yourself, the client will likely keep the connection alive if there is a reasonable expectation that there will be further requests.



In a console application a made before the connection between the client and server was opened until one of them closed the window. (I guess that when they both are in "reiceive mode" they both keep reiceiving)

So it feels like there should be a way to maintain an already established connection even with the browser. Also, it must happen behind the scenes so that it does not look like the browser is "loading" nonstop.

Maybe AJAX can help here?



Last edited on
Topic archived. No new replies allowed.