This simple example of a client/server system is intended to demonstrate how to build applications using just the streams available in the standard API. The chat uses TCP/IP sockets to communicate, and can be embedded easily in a Web page. For reference, we provide a sidebar explaining Java network programming components that are relevant to this application. If you're still getting up to speed, take a look at the sidebar first. If you're already well-versed in Java, though, you can jump right in and simply refer to the sidebar for reference.
We start with a simple graphical chat client. It takes two command-line parameters -- the server name and the port number to connect to. It makes a socket connection and then opens a window with a large output region and a small input region.

After the user types text into the input region and hits Return, the text is transmitted to the server. The server echoes back everything that is sent by the client. The client displays everything received from the server in the output region. When multiple clients connect to one server, we have a simple chat system.
This class implements the chat client, as described. This involves setting up a basic user interface, handling user interaction, and receiving messages from the server.
i can't see code of : public void run () ...By Anonymous on November 16, 2009, 3:44 pmi can't see code of : public void run () .. so can you explain it for me?
Reply | Read entire comment
can you explain more about function this : public void run () .By Anonymous on November 16, 2009, 9:56 amcan you explain more about function this : public void run () ...
Reply | Read entire comment
amizadeBy Anonymous on October 6, 2009, 10:51 amcndcjnsc
Reply | Read entire comment
lookin for some java help By Anonymous on May 6, 2009, 9:53 amlookin for some java help
Reply | Read entire comment
View all comments