I am trying to send some data over the sockets. The first 3 data items are sent successfully but when I try to send the double array then an exception is thrown. Lets come to the code: Client Side:
Socket clisock=new Socket("127.0.0.1",1341);
Scanner sc1=new Scanner(clisock.getInputStream());
PrintStream p=new PrintStream(clisock.getOutputStream());
p.println(num_doc);
p.flush();
p.println(TD);
p.flush();
p.println(num_Decimal);
p.flush();
ObjectOutputStream os=new ObjectOutputStream(clisock.getOutputStream());
os.writeObject(server_index);
Server Side:
int number;
long keyword, keywords;
double[][] server_ind;
ServerSocket s1=new ServerSocket(1341);
Socket ss=s1.accept();
Scanner sc=new Scanner(ss.getInputStream());
number=sc.nextInt();
keyword=sc.nextLong();
keywords=sc.nextLong();
ObjectInputStream is = new ObjectInputStream(ss.getInputStream());
server_ind=(double[][])is.readObject();
Exception: java.io.StreamCorruptedException: invalid stream header: FAD08000
Note: Before posting this question, I have already searched for similar exceptions but havent been successful in removing the exception.