Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Sockets and Winsock (TCP)

Status
Not open for further replies.

davidchardonnet

Programmer
Mar 21, 2001
167
FR
Hello,

I have a C++ TCP server using WinSock in C++, and I try to use a Java Applet that already works with a Java TCP Server. I want to replace de Java server by the C++ Server.

But when I try to connect the java client, the C++ server tells it receives 4 data bytes and prints on the screen 2 strange characters. And the same thing occurs when I send data.

The C++ server works well with a C++ client, and that's the reason why I come here :)

Do you have an idea of what it can be?
Thank you

David
 
hi , this is because java and c++ allocates diffrent byte sizes for same/similar data types. for ex u must be aware that java string is in UTF format while c++ is ascii. Similarly for other variables. I think u'll have to put a jni layer b/w ur java client and c++ server, to make comaptible the data-types. hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top