The Java client can connect to the C++ server using TCP. The Java client is on Win7. The C++ server is on Linux.
The problem is I cannot send data successfully to the C++ server. The Java code is:
public static void main (String [] args ) throws IOException { Socket sock = new Socket("10.217.140.200",7000); String id = "TEST"; char encoding = 'a'; ObjectOutputStream oos = new ObjectOutputStream(sock.getOutputStream()); oos.flush(); oos.writeObject(encoding); After your kind helps, I now use outputstream and it works. Remember to delete the ObjectOutputStream oos = new ObjectOutputStream(sock.getOutputStream()); otherwise it will output 4 chars to c++ server.
oos.flush()should go after theoos.writeObject(), not before.