I would like to transfer a file throught a tcp socket, here there is what the sender program does :
try{
File localFile = new File("shared/"+fileName);
DataOutputStream oos = new DataOutputStream(socket.getOutputStream());
DataInputStream fis = new DataInputStream(new FileInputStream(localFile));
while(fis.available() > 0){
oos.writeByte(fis.readByte());
}
}
catch(Exception e){}
}
and here what the receiver program does:
try{
File downloadFile = new File("incoming/"+fileName);
downloadFile.createNewFile();
ois = new DataInputStream(connectionSocket.getInputStream());
fos = new DataOutputStream(new FileOutputStream(downloadFile));
while(ois.available() > 0){
fos.writeByte(ois.readByte());
}
}
catch(Exception e){}
}
Where i m wrong? it doesnt work

, it just create the new file in the incoming folder, but its size remains 0 byte
help a newbye please
