I want to build a client and server application using Socket programming that can chat but the client and server has to be implemented in different languages.
I want to use C# and Java for that purpose. I want to know if its possible and if it is How?
Thanks
1 Answer
It is possible and pretty easy, especially with C# and Java. Their implementation of sockets is pretty similar.
Few things to watch for:
- Make sure you are serializing integers in network order. If I remember correctly Java and .NET put bytes on the wire in a different order. See this post for some guidance.
- Make sure you are encoding/decoding your strings consistently, like using Unicode on both sides.
- Don't try using
unsignedinteger types, Java only supports signed types (I'm sure there are libraries to deal with it if necessary). - I don't know how compatible
floatanddoubleserializations are on both sides, so if you need it do some more investigation.
Good luck and have fun!