Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Java Socket, ServerSocket with C/C++  RSS feed

 
Elizabeth King
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I use a ServerSocket to communicate with a C/C++ or AS400 client?
Do other languages understand Java stream...
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A TCP socket is a TCP socket, regardless of platform or language. As long as you're exchanging only text data (as in the HTTP, SMTP and POP protocols, and many others) then the fact that one end is Java and the other isn't won't even come up. If you need to exchange binary data, then it might take a little more thought, but as long as you understand the issues, there's no problem.
 
Elizabeth King
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the Java objects and primitives are serialized before put in the "out" stream.
So they are all binary. Right?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, binary, but more importantly, binary data arranged into a Java-specific protocol. Now you're talking about something considerably harder than the text-based protocols I listed above. Now you need an implemementation of the Java serialization library in C++. No doubt someone has writen one -- likely, a commercial vendor -- but I personally don't know of it. Otherwise, you're left trying to do it yourself, which would be a fairly substantial undertaking, both complex and highly platform-dependent.

I would exhaust all other possibilities (including changing the Java code to not use serialization) before going this route.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's move this over to Socket and Internet Protocols.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!