I am trying to produce a java client to a server written in C. The server currently has several existing clients also written in C, and various messages have been defined (as C structures) which are passed between client and server via read/write calls over a socket connection.
I am having problems designing an efficient means to process the messages, I could read the message as an array of bytes, but was unsure how to translate a sequence of bytes into an int for example (Big Endian or little Endian ?), I could translate a sequence of bytes representing a C null terminated string into a Java String easily enough but the whole mechanism would be quite slow for large volumes of data. I also wondered if there were convenience classes (in the public domain) which could be used to read/write such messages from within a java program, I would have thought this sort of problem was quite common.
My company's software is also C++ server / Java client. We use CORBA to do remote connection. Jacorb is our orb on the Java side, and MICO (open source) on the C++ side. Yes, there are pros and cons. It handles the marshalling/demarshalling of messages, but adds certain overhead. You also may not have freedom to suggest architectural changes on the server-side. Just letting you know what some people are doing. Bill
this llama doesn't want your drama, he just wants this tiny ad for his mama
Free, earth friendly heat - from the CodeRanch trailboss