J
jwarzech
I am trying to send a zip file from a client to a server using
sockets. I can get the file to transfer all right but the server
"halts" after the send. Using trace debugging I can see that the while
loop is exiting but any statement afterwards is not being processed.
Client Code
output = new DataOutputStream(client.getOutputStream());
byte[] buffer = new byte[1024];
int r;
InputStream in = new FileInputStream(path + "\\" + file+ ".zip");
while((r = in.read(buffer)) > 0)
{
output.write(buffer,0,r);
}
output.flush();
input.close();
output.close();
Server Code
input = new DataInputStream(connection.getInputStream());
OutputStream out = new FileOutputStream(outFile);
byte[] buffer = new byte[1024];
int r;
while((r = input.read(buffer)) > 0)
{
out.write(buffer,0,r);
}
out.flush();
out.close();
input.close();
//This doesn't display, any idea??
System.out.println("Completed");
sockets. I can get the file to transfer all right but the server
"halts" after the send. Using trace debugging I can see that the while
loop is exiting but any statement afterwards is not being processed.
Client Code
output = new DataOutputStream(client.getOutputStream());
byte[] buffer = new byte[1024];
int r;
InputStream in = new FileInputStream(path + "\\" + file+ ".zip");
while((r = in.read(buffer)) > 0)
{
output.write(buffer,0,r);
}
output.flush();
input.close();
output.close();
Server Code
input = new DataInputStream(connection.getInputStream());
OutputStream out = new FileOutputStream(outFile);
byte[] buffer = new byte[1024];
int r;
while((r = input.read(buffer)) > 0)
{
out.write(buffer,0,r);
}
out.flush();
out.close();
input.close();
//This doesn't display, any idea??
System.out.println("Completed");