{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern