Server acting as both server and client

I have 2 servers - a chat server and world server. Both are connected to clients on different ports. I want to set up a unique port for just the world server to communicate with the chat server. I want the world server acting as a client to the chat server.

How would I go about doing this? I know how to set up 1 port but not mulltiple

This is the basic setup of the servers I have:


		try {
			this.serverSocket = new ServerSocket(this.port);
			this.listening = true;
            while (listening) {
                Socket socket = this.serverSocket.accept();
                socket.setTcpNoDelay(true);
                DebugConsole.print("Client connection from " + socket.getRemoteSocketAddress(), "General");
                PacketAction socketConnection = new PacketAction(socket, this);
                socketConnection.start();
                this.clientConnections.add(socketConnection);
            };
        }
        catch (Exception e) {
            DebugConsole.print("Exception (run): " + e.getMessage(), "Error");
        }


this.serverSocket = new ServerSocket(this.port);
this.anotherServerSocket = new ServerSocket(this.port+1); /* or another random port*/

/* create a thread for each ServerSocket to .accept() connections*/


If you want them both to run asynchronously, then you will need to create another thread for the other socket.