wood burning stoves
The moose likes Sockets and Internet Protocols and the fly likes socket  data compression problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "socket  data compression problem" Watch "socket  data compression problem" New topic

socket data compression problem

bow huang

Joined: Apr 28, 2004
Posts: 4
dear everybody,
i hava a problem in socket data compression:
socket = new Socket(host,4000);
ZipOutputStream zipout = new ZipOutputStream(socket.getOutputStream());
zipout.putNextEntry(new ZipEntry("a.zip"));
DataOutputStream output = new DataOutputStream(zipout);
DataInputStream input = new DataInputStream(socket.getInputStream());
long clientNumber = input.readLong();//1234

ServerSocket serversocket = new ServerSocket(4000);
Socket client = serversocket.accept();
ZipInputStream zipin = new ZipInputStream(client.getInputStream());
input = new DataInputStream(zipin);
output = new DataOutputStream(client.getOutputStream());
long magicNumber = input.readLong();//10000
int intnumber = input.readInt();//222
The app blocked when run to readLong() and readInt(),what's the problem?
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
Try calling output.flush() before attempting to read input.
bow huang

Joined: Apr 28, 2004
Posts: 4
Thanks for your reply,
I will hava a try
I agree. Here's the link: http://aspose.com/file-tools
subject: socket data compression problem
It's not a secret anymore!