Not in the base language, no. You have to do the usual things that you would do in most languages, where you set up your listener, accepted connections, checked for input, etc.
I’m sure that somewhere, someone created a common “infrastructure” for this, but honestly, this is about 40 lines of code, and there are twelve tutorials that show this.
The most similar approach is to use Java NIO classes (1.4 and above) and use Selector to accept and poll new connections and enter into connected sockets.
source share