I have a client that sends a file to the server and sends other values to the server.I managed to transfer the file but it is not opened until i close the socket.So i made another socket in the client side just for sending the file,but the server read it as if it is another client and incremented the clients number and gave me an exception as well saying> Socketexception:software caused connection abort: socket write error.Here is the code of client side with a new socket just for the sending,Can anyone help me about that?Thanks in advance.
try
{
Socket sendSock=new Socket("localhost", 8080);
outC.println("AcceptFile,");
FileInputStream fis = new FileInputStream(p);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
ObjectOutputStream oos = new ObjectOutputStream(sendSock.getOutputStream()) ;
oos.writeObject(buffer);
sendSock.close();
}
catch(Exception c)
{
System.err.println("exc" + c);
}