O'Reilly logo

Learning Network Programming with Java by Richard M Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The chat server/client applications

The intent of this section is to demonstrate how buffers and channels work together in more depth. We will use client and server applications that pass messages back and forth. Specifically, we will create a simple version of a chat server.

We will perform the following actions:

  • Create a server and a client that send messages back and forth
  • Demonstrate how to handle variable length messages

First, we will demonstrate using a fixed size message using the sendFixedLengthMessage and receiveFixedLengthMessage methods. Then we will use the sendMessage and receiveMessage methods to handle variable length messages. Fixed length messages are easier to handle but will not work if the length of a message exceeds the size ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required