Putting the Server and the Client Together

At this point, your asynchronous server and client programs are ready. You need to use the following steps to run the server and the client.

Running the Server Application

Run the AsyncEchoServerSocket class as listed in Listing 5-16. You should get a message on the standard output as follows:

Server is listening at localhost/

If you get the above message, you need to proceed to the next step. If you do not get the above message, it is most likely that the port 8989 is being used by another process. In such a case, you should get the following error message:

java.net.BindException: Address already in use: bind

If you get “Address already in use” error message, you need to change the port ...

Get Beginning Java 8 APIs, Extensions and Libraries Swing, JavaFX, JavaScript, JDBC and Network Programming APIs now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.