I'm trying to create a server with an asynchronous communication model and want to bind multiple ports, but it throws an error "AlreadyBoundException" when I call one more than bind method. Is there any possible way to do this? Here's my code
try(AsynchronousServerSocketChannel listener = AsynchronousServerSocketChannel.open()){
if(listener.isOpen()){
listener.setOption(StandardSocketOptions.SO_RCVBUF, 4*1024);
listener.setOption(StandardSocketOptions.SO_REUSEADDR, true);
listener.bind(new InetSocketAddress(9001));
listener.bind(new InetSocketAddress(9002));