Scott,
I launched WireShark again to watch TCP/IP traffic between my PC and my IBM i server, and I now see what you're talking about. HTTP connections may be persistent, and still generate periodic TCP keep-alive activity. Interestingly, my Telnet client (TN5250J) generates a lot more frequent chatter than my browser (Chrome), from persistent but otherwise idle connections.
Keep-alive requests still don't account for the other activity between the Web Socket client and server at
http://jwebsocket.org, but you have a point. I'll keep watching.
Again, I'm not dissing Web Sockets. They sound like a great interface. I just want to understand the front-end and back-end before adding to the hype.
-Nathan.
----- Original Message -----
From: Scott Klement <web400@xxxxxxxxxxxxxxxx>
To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
Cc:
Sent: Wednesday, July 11, 2012 5:18 PM
Subject: Re: [WEB400] Websockets on the IBMi
Nathan,
TCP keep-alive packets are used to test whether a connection is still
alive, or whether it has been disconnected.
In the olden days, a direct cable would be connected between computers
(for example, RS-232, Parallel, Twinax, etc). If the connected device
was on, there'd be electricity on the cable. If the device was
disconnected for any reason, the electricity would be gone, so the host
could detect the connection disruption. (For example, if a fuse was
blown, or the cable was cut.)
However, with TCP/IP networks there's no equivalent. A packet (SYN) is
set to indicate the start of the connection, another (FIN) is sent to
end the connection. (I'm oversimplfiying, but you get the idea).
Multiple intermediate packets are sent to send data.
But, if a fuse blows, or the cable is cut, the computer goes down
without ever sending a FIN. How can one computer ever detect that the
other computer has disconnected? It can't tell the difference between
the remote computer being "idle" (not sending anything) and an
unexpected disruption (power loss, cable damage, etc).
That's what keep-alive packets are for. They are sent and acknowledged
periodically to detect whether the connection was dropped.
Note that this is done at a very low-level (inside the TCP/IP stack).
It's not really part of Websockets. Keep-alives can be enabled on any
TCP connection, including PC5250, HTTP, SMTP, XMLHTTPReq,... anything...
As an Amazon Associate we earn from qualifying purchases.