• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

C Server - Java Client

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic