I am new to Java, I learned the basics and wondered how servers are created in Java. I can write an application that will listen to a specific port and respond to it via a socket connection - whether it is a server. If yes then why do you need tomcat

Closed due to the fact that the question is too general for participants a_gura , Ella Svetlaya , Alexey Shtanko , fori1ton , null Jun 11 '15 at 13:20 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

1 answer 1

A server is any application waiting and processing a connection. So what you wrote is a server. But, as a rule, you need not only a socket connection, but also the processing of http requests. In order for each application not to write its own server and not to rewrite the code in case of changing the parameters, we made servlet containers such as tomcat and jetty. Servlet containers process requests and allow you to concentrate on the logic of the application, rather than on requests.