May be I am missing something very simple. But after doing multiple search I am unable to find a solution for my scenario.
I have a python web server running on my localhost with multiple endpoint. ( not written by me). I am trying to interact ( receiving and posting some data) with the server using java.
The example I have seen in Java client python server socket programming or in Send File From Python Server to Java Client using InetAddress and port number to connect the server. But I want to create separate connections for different endpoints - for example : localhost:8080/endpoint1 or localhost:8080/endpoint2
Is there any way to specify the endpoint in java.net.Socket while making the connection? Or I have to use other API ?
Example shown in http://www.programmingforliving.com/2013/08/jsr-356-java-api-for-websocket-client-api.html does use full URI to connect, but here the server code is annotated to make it work. I can not change my python server code.
Any help is hugely appreciated.
new Socket("localhost", 8080)in both cases. But then you have to speak HTTP. You should be using theURLclass, not aSocket.