CLChatClient - /* This program is one end of a simple...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* This program is one end of a simple command-line interface chat program. It acts as a client which makes a connection to the CLChatServer program. The computer to which the client is to connect must be specified as the first command-line argument. The port on which the server listens can optionally be specified as the second command-line argument. If it is not, then the port specified by the constant DEFAULT_PORT is used. When the connection is opened, each side sends the HANDSHAKE string to the other, so that both sides can verify that the program on the other end is of the right type. Then the connected programs alternate sending messages to each other. The client always sends the first message. The user on either end can close the connection by entering the string "quit" when prompted for a message. Note that the first character of any string sent over the connection is a command, either MESSAGE or CLOSE. */ * import java.net.*; import java.io.*; i public class CLChatClient { p static final int DEFAULT_PORT = 1728; // Port where server is // listening, if no // port is specified // on the command line. static final String HANDSHAKE = "CLChat";
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2010 for the course CSC 115 taught by Professor Jackson during the Spring '09 term at University of Victoria.

Page1 / 3

CLChatClient - /* This program is one end of a simple...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online