The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


send zip file across wire using client / server sockets

Posted by John on August 30, 2000 at 4:11 PM

I'm writing a simple server program which takes a zip file and tries to write its contents to the output stream of a socket.

Platform: windows NT 4.0
jdk 1.2.2-006

PROBLEM: a is thrown when I call putNextEntry of ZipOutputStream.

Here's the stack trace: Connection reset by peer: socket write error
at Method)
at Source)
at Source)
at Source)
at Source)
at classloader.SampleServer.invokeServer(
at classloader.SampleServer.main(

Here's the code snipet from my SampleServer class:

serverSocket = new ServerSocket(4444);
clientSocket = serverSocket.accept();
zipOutputStream = new ZipOutputStream (clientSocket.getOutputStream());
//archive is my existing zip file
archive = getZipFile();
for (Enumeration e = archive.entries(); e.hasMoreElements();)
ZipEntry zipEntry = (ZipEntry) e.nextElement();
//****here's where the problem seems to lie***********

Please let me know what I'm doing wrong, and how I can fix it so I can send zip file contents across, using sockets.



Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us