How to chain a GZIPOutputStrime to a ObjectOutputStream in a socket?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Robert_Gervais
Posted On:   Tuesday, April 16, 2002 06:13 PM

I want to exchange objects between sockets, and I want to use a GZIP stream over my object stream in order to reduce the size of the data transmitted over the Internet. But, when I chain a GZIP stream, everthing got deadlocked. As mentioned in one of your FAQs, I always open the ObjectOutputStream before the ObjectInputStream and I flush the stream in order to allow the initial handshaking of these streams. It works fine when I don't chain any other stream (e.g. if I remove the new GZIP stuff...). I use the same code in both client and server side to open the streams. I'm experimencing the same problem if I replace the GZIP stream by a Buffered stream. ObjectOutputStream oos; ObjectInputStream ois;    More>>

I want to exchange objects between sockets, and I want to use a GZIP stream over my object stream in order to reduce the size of the data transmitted over the Internet. But, when I chain a GZIP stream, everthing got deadlocked.


As mentioned in one of your FAQs, I always open the ObjectOutputStream before the ObjectInputStream and I flush the stream in order to allow the initial handshaking of these streams. It works fine when I don't chain any other stream (e.g. if I remove the new GZIP stuff...). I use the same code in both client and server side to open the streams. I'm experimencing the same problem if I replace the GZIP stream by a Buffered stream.


			
ObjectOutputStream oos;
ObjectInputStream ois;
if (GZIP) {
oos = new ObjectOutputStream(new GZIPOutputStream(mySocket.getOutputStream());
}
else {
oos = new ObjectOutputStream(mySocket.getOutputStream());
}
oos.flush();

if (GZIP)
ois = new ObjectInputStream(new GZIPInputStream(mySocket.getInputStream()));
else
ois = new ObjectInputStream(mySocket.getInputStream());


Any clue?

   <<Less
About | Sitemap | Contact