Yes, setup your C++ socket, and setup a Java socket. That's it.
In Java, we use the Socket(String ip_or_host, int port) to connect a client socket.
Socket socket = new Socket("java.sn.com", 80);
That code would create a socket connection to the Java web server port 80 (HTTP).
You simply set your C++ socket as a server socket, and listen on whatever port you want to run your service on. Then, set the java socket to connect to that port on that machine.