• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

C++ Java Interaction

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I pass parameters from a C program to a Java code using sockets??
I am able to pass a char[] now,but the value is garbled when it is received by the Java server,which might be because of differences in bytes.Can any of you help me out with a cleaner solution?.
Also,how would I pass Object(Vector,HashMap,etc.) from Java to C via sockets??
Thanks!!
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Priya Vasudevan:
How do I pass parameters from a C program to a Java code using sockets??


If I understand the question correctly, u r trying to communicate using sockets between a server written in C program, and client written in Java.
If that is the case, then u shouldn't be getting garbled values. I had once communicated with telnet application, initially I also got some junk values, becoz of some problem with socket connection (It is difficult to debug, in such cases), but after making appropriate corrections in the code, it worked fine.
For the 2nd part of your question, refer this link
Interacting with Java from the Native side
regards,
Gopals.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to consider encoding whatever objects you're passing back and forth into XML documents. That way, the receiver would always know which encoding to use and the characters wouldn't get "garbled." Of course, this would bring some added complexity into the applications themselves (having to create/parse XML documents and map them into Java objects or C structs).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well try out using SOAP, you will not get garbled values.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic