|
I have a socket RPG program that is sending a request to a Java Servlet on Tomcat. The send works fine, but I am having trouble making sure I am getting the entire response; how do I know I have the whole response? Right now I stop reading after I get two CRLF's(0D 25 0D 25) right in a row. I then went out to the RFC 2616 only to find that I should probably be looking for "chunks". Here is a quote from the site (http://www.ietf.org/rfc/rfc2616.txt). Right now I am getting this as the last sequence of characters -> "0D 25 F1 0D 25 25 0D 25 F0 0D 25 0D 25" <snip> The chunked encoding modifies the body of a message in order to transfer it as a series of chunks, each with its own size indicator, followed by an OPTIONAL trailer containing entity-header fields. This allows dynamically produced content to be transferred along with the information necessary for the recipient to verify that it has received the full message. Chunked-Body = *chunk last-chunk trailer CRLF chunk = chunk-size [ chunk-extension ] CRLF chunk-data CRLF chunk-size = 1*HEX last-chunk = 1*("0") [ chunk-extension ] CRLF chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) chunk-ext-name = token chunk-ext-val = token | quoted-string chunk-data = chunk-size(OCTET) trailer = *(entity-header CRLF) The chunk-size field is a string of hex digits indicating the size of the chunk. The chunked encoding is ended by any chunk whose size is zero, followed by the trailer, which is terminated by an empty line. </snip> My question is does anybody have something like this already laid out in code so I don't have to cover all of the different bases that a host could possibly send back to me? Or does somebody have a catch all that will allow me to always make sure that I have received the entire response? Or is the sequence that I have above ("0D 25 F1 0D 25 25 0D 25 F0 0D 25 0D 25") what I need to be looking for to know that the request has completed in its entirety? Thanks, Aaron Bartell
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.