I'm starting to learn about servlets, I know that if I deploy the servlet on the server then I can access that servlet using a get request via browser. now the question I have is that is it possible to access the same servlet from a java desktop application(Using sockets.)?
here is my client side code:
public class SocketClient {
public static void main(String[] args) throws IOException {
Socket myClient;
Scanner reader;
myClient = new Socket("http://localhost:8080/HelloWorld/MyFirstServlet", 8080);
reader = new Scanner(myClient.getInputStream());
System.out.println(reader.nextLine());
}
}