I don't really know what im doing wrong, just trying to send an object called 'packet' from server to client using TCP.
This is how its serialized and sent server side
bos = new ByteArrayOutputStream();
objectOut = new ObjectOutputStream(bos);
String objectBytes = bos.toString();
Here is the client side code
String data = br.readLine();
byte objectData = data.getBytes();
bis = new ByteArrayInputStream(objectData);
in = new ObjectInputStream(bis);
packet = (Packet) in.readObject();
This is sending strings, i tried doing it by just sending a the length of the byte array, then the byte array and reciving it like that client side but just couldnt get it working. Ive had several errors probably most commen is this 'java.io.StreamCorruptedException: invalid stream header', but i also get a 'java.io.EOFException' error. Am i go going about this completely the wrong way?