A web server is used to process http request and send a response back to the client browser. I was wondering how does a client browser send a http request to the web server? Is it done via socket connection? Which socket connection is used to establish a connection with tomcat web server? Is it using Java sockets or the client browser have it's own socket to establish a connection with the Tomcat server? Or does the client browser uses the socket provided by the operating system to establish a connection to the Tomcat server?

Huh? I am not sure about your question. I don't think a servlet uses socket connection but rather has a listener on a port. I think a HTTP request from a web browser gets through layers of Internet architecture, and the servlet picks up. Then it sends back through the similar layers to the client. If I remember correctly, certain configuration from the server (tomcat in this case) will affect the way of communication as well.

Is it done via socket connection?

Yes

Is it using Java sockets or the client browser have it's own socket to establish a connection with the Tomcat server? Or does the client browser uses the socket provided by the operating system to establish a connection to the Tomcat server?

Socket API is provided by the OS. The socket libraries provided by runtimes like JVM(Java), Python, Ruby are all wrappers over the OS sockets. These networking libraries/infrastructure just provide an abstraction so that you don't need to know the implementation details of the socket API for each and every platform/OS.

I don't think a servlet uses socket connection but rather has a listener on a port

This statement is incorrect and doesn't make a lot of sense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.