Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Resolved: Reading from a Socket's InputStream



I've resolved the problem I was having reading the content of an HTTP request using J2SE's low-level socket interface. The problem I was having was that the socket's input stream was only returning a portion of the content and so the receiving application was blocking waiting for the rest to arrive. This problem ended up being caused by stream buffering issues. I was using a Reader to parse the headers, but was using the socket's InputStream to read the contents. What I didn't fully appreciate was that the Reader was buffering data. As a result, some portion of the content had already been read into the InputStream's buffer before my application started trying to read the document content.

Thanks to everybody for their input on this problem. Everybody asked good questions. It was in the process of answering these questions that I discovered my mistake.

- Sparky
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Reading from a Socket's InputStream (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.