This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes ObjectOutputStream header Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "ObjectOutputStream header" Watch "ObjectOutputStream header" New topic
Author

ObjectOutputStream header

Joe Crew
Ranch Hand

Joined: Apr 02, 2001
Posts: 49
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: ObjectOutputStream header
 
Similar Threads
Socket communication between C server and Java Client
Problem using apache HttpClient 3.1 to sent large requests
Java client and C server socket
Protocols
UDP issues