GitXplorerGitXplorer
a

cliserchat

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
53b238ff33ae383e665bdd9bdbccdea3bf84f920

implement suggestions from eclipse

aabchk1234 committed 10 years ago
Unverified
177db655a74e5c724f4268957e14f08716533eff

formatting

aabchk1234 committed 10 years ago
Unverified
e5e7b89c38af4661839778d00d00bbdad8810f34

some bug fixes

aabchk1234 committed 10 years ago
Unverified
b9398e6b36ca71044f18d87120063c8b7351fd71

fix status codes when sending messages

aabchk1234 committed 10 years ago
Unverified
3266d627732657cb9ea395085befbf5277ba30af

Add gitignore

aabchk1234 committed 10 years ago
Unverified
e46c6ce5eec31df3b71df27740ae00b87e582afa

Try to split up common parts

aabchk1234 committed 10 years ago

README

The README file for this repository.

This is a Client-Server Chat Application, written in java, using sockets. Using this one can connect 2 people/computers/terminals.

Requirements- java (jre / java runtime environment)

Usage-

The Server program is named as MyServer.class and the Client program is named as MyClient.class

The Server needs to be started first. It can be started by typing MyServer in the terminal, inside the folder where the MyServer.class file is present:

$ java MyServer

Then the Client can be started similar to the server, like:

$ java MyClient

By defualt, when no arguments are specified, both the client and server are assumed to be on the same system/host, and the port 1025 is used for communication.

Different ports for the server can be used as:

$ java MyServer 2055

Then to connect the client to the server:

$ java MyClient 2055

This assumes that the server is on the same system/host as the client; if the server is located elsewhere, one can use the form:

$ java MyClient 192.168.1.4

Here 192.168.1.4 is the IP address of the server.

If you get a "Connection refused" exception, then perhaps you have given the wrong IP or port address.

When connecting from different machines, the ports for the communication should be available; otherwise you could get a "Connection timed out" exeception.

Code-

The code is included along with the class files, as MyServer.java and MyClass.java, and is licensed under the GNU GPL.

If the class files are not running on your system, or you want to modify the code, one can use-

$ javac MyServer.java

and

$ javac MyClient.java

to compile the code to class files (requires jdk / java development kit).

Note-

This application is not multithreaded, so at a time only a single client can chat with the server.

If two people want to communicate using this application, one can run the server, and the other can run the client, giving the IP of the server.

If the 2nd person wants to initiate the chat, then he can start the server, and the 1st person can run the client.

Demo-

a) Starting the server-

$ java MyServer

Client-Server Chat Application

Press Ctrl^C or Alt+F4 to quit this application.

Server- Using port: 1025 Waiting for connection from Client..

b) Starting the client on another terminal and typing a message-

$ java MyClient

Client-Server Chat Application

Press Ctrl^C or Alt+F4 to quit this application.

Client- Using port: 58541 Successfully connected to Server. IP: /127.0.0.1 Port: 1025 Name: localhost

Enter message (Type /y to terminate the message) : Hello /y

Waiting for response...

c) The server gets the clients message and responds-

Connection received from client. IP: /127.0.0.1 Port: 59048 Name: localhost

Waiting for response...

CLIENT-> Hello

Enter message (Type /y to terminate the message) : Hi /y

Waiting for response...

d) The client receives the message-

SERVER-> Hi

Enter message (Type /y to terminate the message) : How are you? /y

Waiting for response...

e) And so on..

On pressing Ctrl^C, the application quits.