Tuesday, June 15, 2010

Multi client - server program

For an interview process, i was asked to write a simple chat server server( socket programming) which handles multiple clients and it should broadcast a client msg to all other clients who connected to the server at that instance. And the client side chat window should be designed in QT.

The code is attached to the following link.

Server side program;

Client side program.


Steps for compiling and checking the demo:

pre requiste : qt4.3-dev tools , or qt libraries need to be installed.

Step1 : Un install the server.zip into a folder. (name: server )

> qmake -project
> qmake
> make

> ./server 50003 ---> Example to run the server.

Step 2: Un install the client.zip into a folder.( named: client )

> qmake -project
> qmake
> make

>./client mani 50003 ---> Example to run the client.

As soon as you give the above command, a qt based chat window will open on which you can type your chat messages.

Parallely open 3,4 terminals and instantiate the client program with different names, so that you will see similar chat windows opened.

On each you can type messages, which will be broadcasted to others.
I have tried it on ubuntu.