   Java, UDP, and serializing
  Hey,  I am trying to serialze an object which is an instance of a class I have set to implement serializable, pass it as a byte array using a datagram socket, and then deserialize it back into an object.  The object is of class Player and Player implements serializable.  Here is the code I use to serialize the object ByteArrayOutputStream baos = new ByteArrayOutputStream();ObjectOutputStream oos = new ObjectOutputStream(baos);oos.writeObject(thePlayer);byte[] playerDat= new byte[1024];playerDat = baos.toByteArray();send(playerDat);When I deserialize the exact same byte array playerDat  (without sending it), I reconstruct the object exactly.  However, after passing it as a datagram packet, and I try to deserialize it withsocket.receive(p);ByteArrayInputStream baos = new ByteArrayInputStream(playerInfo);ObjectInputStream in = new ObjectInputStream(baos);tempPlay= (Player) in.readObject();I succeed in creating a new player object, however it does not contain the same state as the object that I thought I passed.  Instead I create a new initialized Player object.  Now, I have checked in detail that the byte arrays (playerDat on client side before UDP, and playerInfo on server side after UDP) contain exactly the same data.  However, we I try to seserialize the one on the server side after UDP, I get a new player object with the wrong state.  It is instead the state of a new initilized Player object.  Any help would be greatly appreciated.   
  playerInfo is the byte array in the datagram packet p.   ;  What is even more insane is that after I receive this packet on the Server, I broadcast it to the clients.  At the client end, I can deserialize it into the correct object!!!  The code I use to deserialize at the server and at the client is exactly the same, and the packet (byte array) is the same....   ;  okay, well, I change the Player variable that I was using to deserialize the bytearray.  It worked and deserialized fine.   