• Post Reply Bookmark Topic Watch Topic
  • New Topic

ObjectOutputStream header  RSS feed

 
Joe Crew
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have created a Client/Server app that uses a socket. The Client is in Java but the backend server is in C++. If it was all in Java this would not be a problem but I do what I am told. Anyway the Java Client has a message it wants to send to the Server. The message is a Java String Object I have created. When I build the string I add a 6 byte header that contains the length of the entire String. Simple enough. I then send the Serialize String to my C++ Server. It works perfect except over on the C++ server I notice that I get an EXTRA 3 byte header attached to the String I send. From what I understand, when using ObjectOutStream and writeObject(), block data is sent with a header and data. The header consists of a marker and the # of the bytes to follow the header.
Here is my question: Is this header being sent ALWAYS the same size. Right now when I send a Serialized object String the header is 3 bytes. But what if I send something else like a graphic or a font, will this header still be only 3 bytes? Has anyone seen any clear definition of what data this header contains, specificaly, what is the marker in the first 2 bytes. Does this header get larger with larger Object Strings? Any information someone can give me on this header would be really appreciated. So far I have not found any good information myself.
Joe Crew
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!