Linux Internals Projects for Beginners | Tcp/Ip Chat Application Using C

HomeLinux Internals | Course HomeLinux Internals | ProjectsLinux Internals Project | TCP/IP Chat Room

Linux Internals Projects for Beginners | TCP/IP Chat Application using C

About this project

Linux Internals Projects for Beginners – Implementation of TCP/IP Chat Application. Chat service will be provided for multiple users as clients. 

Share via :

About this project

TYPE Individual project
DIFFICULTY Intermediate
ESTIMATED TIME 40 hours
PUBLISHED 15th March. 2021
CONTACT training@emertxe.com

Introduction

Web based chat applications is one of the more commonly used tool for effective two-way communication. It was originally started off as IRC based chat-rooms which has eventually emerged as multiple formats like Google Meet, WhatsApp, Skype etc. As time passed, these chat applications also started supporting various data types like plain text, images, videos and offering advanced functionalities like recording. Internally these applications use TCP/IP based client-server mechanism designed in large scale to handle multiple users. The idea of this project is to implement a chat room with minimal functionality using TCP/IP based sockets in a Linux based LAN environment. 

 

For this Linux Internals Projects for Beginners project a concurrent server application should start first and start running in a particular machine. Client Application can be initiated from any of the machines in the same LAN, which automatically connect with the server. Before allowing a client / user into the chat room, it will perform authentication by validating username and password. There are many ways to implement this in Linux, however a simple text based user-name and password database is stored against which the incoming request is authenticated. 

 

After successful authentication the client / user is allowed into the given chat room. After entering the user should be able to send messages to all the users in the group and read the messages in the room. Finally, the client can exit the chat room by giving a specific command. By implementing this project in a LAN environment participants will get a hands-on perspectives in TCP/IP Socket programming, Data-base handling, Authentication etc. Detailed requirements are provided below.

Requirement Details

Here is the list of requirements that need to be implemented in this project. In this project implementation, there are two major players that is server and client. Along with that UI requirements also plays an important role in this project. All requirements are provided as follows.

  • Server Requirements:
      • The server creates a TCP socket by binding itself to port 6333
      • It should be a concurrent server allowing individual clients to establish new connections
      • Server should provide client with a user-name & password upon successful connection
      • Registered users are stored in a file by the server as a database
      • Server should allow a registered user to login the service
      • When incorrect user credentials are sent, the server should deny the service 
      • When an authorized user is connected, server should send back list of on-line users
      • When a user joins or leaves, the server should notify this event to other online users
      • Client should send a logout, upon which their entry will get deleted from database
      • When the client is connected, all messages sent from all clients should be sent to all. This will provide them with a chat-room experience, similar to a WhatsApp group
  • Client Requirements:
      • Allow the user to register on the server
      • Allow the user to login to the service
      • Allow the user to display current on-line users
      • Allow the user to logout from the service
  • User Interface Requirements:

Server will run in background with no user-interface.Following are the UI requirements. 

  • Login / register interface: 
  • Authentication by username and password:
  • Chat options (single chat / group chat / logout):
  • Print all on-line users after login:
  • New user alert:
  • Print status when user goes offline:
  • Error handling:

Skeleton Code

The skeleton code in a very interesting concept used in Emertxe. By looking into the skeleton code, you will get a clear picture into converting the given requirement into a working solution. This will also take care of important aspects like modularity, clean coding practices, re-usability etc.

 

Click Here to Download the Source Code for TCP/IP Chat Room Project

Sample Output

Here are the sample output expected by the end of project execution.

Linux Internals Projects for Beginners |  TCP/IP Chat Application using C

Fig1: The server code waiting for client. Should run unless the user terminates it.

 

Linux Internals Projects for Beginners |  TCP/IP Chat Application using C - Output 2

Fig2: The first client trying to connect to the server. The main screen to Login (if already registered) or Register and login. Proceeding to Register option.

 

Linux Internals Projects for Beginners |  TCP/IP Chat Application using C - Output 3

Fig3: Registration Success. Observe the INFO from server. Upon registration the client program should provide different Chat Options. Proceeding to Multi-chat Option. Note no other user is Online yet.

 

Linux Internals Projects for Beginners |  TCP/IP Chat Application using C - Output 4

Fig4: Updated Server messages with First user’s activities

 

Linux Internals Projects for Beginners |  TCP/IP Chat Application using C - Output 5

Fig5: Login from second user. Note info from server on existing Online user.

 

Linux Internals Projects for Beginners |  TCP/IP Chat Application using C - Output 6

Fig6: Update on the First users screen

 

Fig7: Updated Server messages with Second user’s activities

 

Fig8: Chat Screen of First User. Observe the login information of Third User and chat messages from other users and how the First User logged out.

 

Fig9: Second Users Chat Window. Observe the logout information of First User.

 

Fig10: The Third Users Chat Window

Fig11: Updated Server Log

Requirement Details
  • Client Requirements:
  • User Interface Requirements:
Requirement Details
  • Client Requirements:
  • User Interface Requirements:

similar projects