Hi, I'm having a problem reciving serelized objects through a socket,

the code from the client is :

Socket SocketC = new Socket(ip,port);

//A class defined by myself that implements
//Serializable
SignedData Data=new SignedData(new String(b),dsa.sign(),pub);


ObjectOutputStream send = new ObjectOutputStream(SocketC.getOutputStream());

//sends the object SignedData
send.writeObject(Data);
//sends a String object
send.writeObject("Interface");
//flushing the stream
send.flush();


//Reciving objects, code from server side

ServerSocket SocketS = new ServerSocket(port);
Socket client = SocketS.accept();

ObjectInputStream ois=new ObjectInputStream(client.getInputStream());

//Reciving the SignedData Object
SignedData signed = (SignedData)ois.readObject();

//Reciving the String Object
String cad = (String) ois.readObject();

//I also tried with the next line for reading the string instead of the one before
String cad = (String) ois.readUTF();


It's ok when reading the first object, but when trying to read the second I got this exception

java.io.StreamCorruptedException: invalid stream header

it happends the same if I change the order of the objects (of course I change them at writing and reading) I dont know what the problem is, it can only read the first object