My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://ashokbasnet.com.np
and update your bookmarks.

Tuesday, June 15, 2010

Client Sever Application in C

This project is intended to be done as Mini Project for Computer Programming I as the syllabus of IOE, TU. The project is based on networking in C programming.
The project is based on the client server architecture and its communication protocols. The project basically is divided into two sections:- Server and Client. The server has the full control of the information. The server can manage the information of the students and host the server to listen to clients so that client can get required information.
The features of the project include client which can chat with server for any reason or can search the information of a particular student. The chat part basically deals with message sending and receiving between server and client. When a client requests for the chat, server starts the session of chat and both can send and receive the message one at a time. When the chat session needs to be closed any user can type “end” and send it over network.
The server can store the information of the students and do all sorts of modification, search, delete them. The information is stored in the file at server. When client requests for it, the server searches the required from the file and replies back to the client.
This project is an implementation of how the information is exchanged in any network using sockets. Windows sockets 2 (Winsock) is used to create application capable of transmitting data across network independent of the network protocol being used. Winsock follows the Windows Open System Architecture (WOSA) model; it defines a standard service provider interface (SPI) between the application programming interface (API), with its exported functions and the protocol stacks. It uses the sockets paradigm that was first popularized by Berkeley Software Distribution (BSD) UNIX. It was later adapted for Windows in Windows Sockets 1.1, with which Windows Sockets 2 applications are backward compatible. Winsock programming previously centered around TCP/IP. Some programming practices that worked with TCP/IP do not work with every protocol. As a result, the Windows Sockets 2 API adds functions where necessary to handle several protocols.
The system is basically divided into two broad section:-
  • Server :- It is responsible for hosting the server so that client can start communication session.
  • Client :- Client connects to the server by giving the server IP address and port number to which it should connect to.

Application Block Diagram:



Some screenshots of the program output are:
1. Client Chatting with the sever
  2. Server replying to client Request for student Information

Downloads:-

1. Project Executable file
        You can run the application in a single machine(don't need two machines at LAN) to test the application. Open two exe file of the application and in one go to server mode with password "ioe". U can manage the student information that can be later searched by the clients.
In next application go to client mode and join the server. For same computer

IP address:- 127.0.0.1

Port:- 5000


2. Source Codes:-
   The code is divided into four header pages and a c source file.
The project was done in Code::Blocks, so u need include a library file for accessing winsock header file , i.e. WS2_32.lib.

3. Report
    References:-
    1. MSDN help site for the winsock application in Visual C++
    http://msdn.microsoft.com/en-us/library/ms740632%28v=VS.85%29.aspx

    2 comments :

    1. The project is simply an application of Socket Programming in Windows using C. The system is limited to single client and information sharing between that client and the server. Future enhancement can be done as multiple clients handling and giving more services to clients.
      The mini project as its name implents only sockets used to create a connection between computers in network.

      ReplyDelete
    2. can we execute the same project in linux?
      please reply me as soon as possible..

      ReplyDelete