Sei sulla pagina 1di 25

A Project Report

On
Chat Application

Submitted By:
Manvir Singh
UE168065
BE - IT 2
ACKNOWLEDGEMENT

If words are considered as a symbol of approval and token of appreciation then let
the words play the heralding role expressing my gratitude.

The satisfaction that accompanies that the successful completion of any task would
be incomplete without the mention of people whose ceaseless cooperation made
it possible, whose constant guidance and encouragement crown all efforts with
success. We are grateful to our project guide Ms. Sangeeta Solanki for the
guidance, inspiration and constructive suggestions that helpful us in the
preparation of this project. We also thank our colleagues who have helped in
successful completion of the project.

MANVIR SINGH
INTRODUCTION

Teleconferencing or Chatting, is a method of using technology to


bring people and ideas “together” despite of the geographical
barriers. The technology has been available for years but the
acceptance it was quit recent. Our project is an example of a
chat server. It is made up of 2 applications the client application,
which runs on the user’s Pc and server application, which runs
on any Pc on the network. To start chatting client should get
connected to server where they can practice two kinds of
chatting, public one (message is broadcasted to all connected
users) and private one (between any 2 users only) and during
the last one security measures were taken.
SYSTEM ANALYSIS

 System Objectives

Communication over a network is one field where this tool finds wide ranging application.
Chat application establishes a connection between 2 or more systems connected over an intra-
net or ad-hoc. This tool can be used for large scale communication and conferencing in an
organization or campus of vast size, thus increasing the standard of co-operation. In addition it
converts the complex concept of sockets to a user friendly environment. This software can have
further potentials, such as file transfer and voice chatting options that can be worked upon later .

 Relation to External Environment

This tool helps in two major aspects -



Resolving the names of all the system connected in a network and enlisting them.

Used for communication between multiple systems enlisted in the resolved list.

 Design Considerations

Approach:

The tool has been designed using C# (Windows Form Application).

Methodology:

The user interacts with the tool using a GUI.

 The GUI operates in two forms, the List form & the chat form.
 The List form contains the names of all the systems connected to a network.
 The chat form makes the actual communication possible in the form of text.
SYSTEM SPECIFICATION

 Hardware requirements

In hardware requirement we require all those components which will provide us the platform for
the development of the project. The minimum hardware required for the development of this
project is as follows—

Ram- minimum 128 MB


Hard disk—minimum 5 GB
Processor- Pentium 3
Floppy drive 1.44” inch
CD drive

These all are the minimum hardware requirement required for our project. We want to make our
project to be used in any. Type of computer therefore we have taken minimum configuration to a
large extent.128 MB ram is used so that we can execute our project in a least possible RAM.5 GB
hard disk is used because project takes less space to be executed or stored. Therefore minimum
hard disk is used. Others enhancements are according to the needs.

 Software requirements

Software’s can be defined as programs which run on our computer .it act as petrol in the vehicle.
It provides the relationship between the human and a computer. It is very important to run
software to function the computer. Various software’s are needed in this project for its
development.

Which are as follows—?

Operating system—Windows 7
Others—Visual Studio

We will be using visual basic as our front hand because it is easier to use and provides features to
the users which is used for the development of the project.
System Design Detail

 5.1 GUI Module Name and Description

This module deals with the application’s interface with the end user. All the user inputs (refreshing,
connecting, chatting) are captured here.

.1 Design Alternatives


Structured programming approach is used as the tool has been developed in Win64

platform.

.2 Design Details

At a minimum, the following should be described -

a) Processing within module


We develop the user interface for the application through which the user interacts with the tool. It
consists of a main window and boxes which are displayed as per the menu selections made by the
user. There are different controls such as edit controls, buttons etc which are used to get the user
inputs.

b) Error checking

Errors occurring because of connection problems. Errors occurring due to incorrect input by the
user.

 Resolving Names Module Name and Description

In this module the application resolves the names of the systems connected to a network. These names
are displayed in the form of a list.

.1 Design Alternatives


Structured programming approach is used as the tool has been developed in Win64 platform.

Object oriented approach is an alternative to this.

.2 Design Details

At a minimum, the following should be described


a) Processing within modules

We provide two buttons: Refresh and Connect to the user, to provide input on the basis of
selection using mouse event. This module consists of the following two sub-modules


REFRESH:
This refreshes the list of names indicating to the respective systems connected in the network.

CONNECT:

This connects the host system to the selected system (if any) and opens the next form with this
connection. If no system is selected, then an error message is shown, which tells a user to select a
system first.

b) Error checking

Errors occurring during file saving operations.

.3 Assumptions
 All IP addresses fall in the same range.
 Firewall is turned off for intranet.

 Connection Modules Names and Description

In this module the user communicates with the desired user in the form of text. A connection is formed
between the host system and the desired user with the help of sockets which itself uses ports for packet
data transfer.
.1 Design Alternatives


Structured programming approach is used as the tool has been developed in Win64
platform.

Object Oriented approach is an alternative to this.

.2 Design Details

At a minimum, the following should be described –

a) Processing within modules


We show a windows form application that makes communication graphic oriented and user friendly.
Three GUI interfaces are captured under this:


TEXTBOX :
Here the user enters the message to be sent to the remote user.


RICH TEXTBOX:
In this module the message sent is pasted under host name and the message received

displayed under the remote users name.


SEND BUTTON:
When this button is pressed, the message in the textbox is displayed in the rich

textbox under the host’s name and also it is sent over the network to the remote

machine where it is displayed in the textbox under the sender’s name.


b) Error checking

Errors occurring during file opening operations

.3 Assumptions

 All IP addresses fall in the same range.


 Firewall is turned off for intranet.

System Implementation And Maintenance

 Implementation
Implementation is a vital step in ensuring the success of new system even a well designed system can fail
if it is not a properly implemented. Implementation activities are needed to transform a newly developed
information system into an operational system for end users.

.1 Acquiring Hardware Software And Services:

These resources acquired from many sources in the computer industry. Some sources are as follows

a-hardware- IBM, HP, Apple computer etc.

b- software- Microsoft, Oracle etc.

.2 Testing:

Testing of a developed system is an important implementation activity. System testing and debugging
computer programs and testing information processing procedures.

.3 Training methods:

A-Vendor and in service training-Vendor offers extensive educational programs as part of their services

.the courses by experiences trainers and sales personnel ,cover all aspects of using the equipment
.participant actually use the system in the presence of trainer. It questions arise, they can quickly be
answered.

B- In house training- It is offered by special purchased instructional materials training manuals on site.
.4 System documentation:

Installing and operating a newly designed system or modifying an established application requires a
detailed record of that system’s design. Documentation is important in diagnosing errors and making
channel .documentation serves as a method of communication among the people responsible for
developing implementing and maintaining a system.

 Maintenance

Once a system is fully implemented & being operated by end user & the maintenance function begins
.System maintenance is the monitoring to evaluating &modifying of operational information system to
make desirable or necessary improvements .for example the implementation of a new system usually
results in the phenomenon known as the leaning curve .person who operates &use the system will make
mistakes simply because the are not familiar with it .Though such errors usually diminished experience is
gained with a new system ,they do point out areas where system may be improved . Maintenance is also
necessary for the failures and problems that arise during the operation of a system .the maintenance
activity includes a post implementation of a system review process to ensure that newly implemented
system meet the system development objective established for them . Errors in the development of a
system must be corrected by the maintenance process .this includes a periodic review or audit of a system
to ensure on operating system &meeting its objective.
APPENDIX [A]

Source Code

Form1.cs

//Code for the first form that enlists the names:

//library classes

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Diagnostics;

using System.Net;

using System.Net.Sockets;

using System.IO;

namespace Chat_App

{
public partial class Form1 : Form

Form2 frm1; //object for next form


int portNo = 1; //ports to be used

public Form1()

InitializeComponent();

//code for resolving names on initialization

private void Form1_Load(object sender, EventArgs e)

Process netUtility = new Process();

netUtility.StartInfo.FileName = "net.exe";

netUtility.StartInfo.CreateNoWindow = true;

netUtility.StartInfo.Arguments = "view";

netUtility.StartInfo.RedirectStandardOutput = true;

netUtility.StartInfo.UseShellExecute = false;

netUtility.StartInfo.RedirectStandardError = true;

netUtility.Start();

StreamReader streamReader = new StreamReader(netUtility.StandardOutput.BaseStream,


netUtility.StandardOutput.CurrentEncoding);

string line = "";

while ((line = streamReader.ReadLine()) != null)

if (line.StartsWith("\\"))

lbNames.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());


}

/* if (lbNames.ItemHeight == 0)

{wwww

lbNames.Items.Add("No systems connected..\nPleace check LAN");

}*/

streamReader.Close();

netUtility.WaitForExit(1000);

this.lbNames.MouseDoubleClick += new MouseEventHandler(lbNames_MouseDoubleClick);

private void lbNames_SelectedIndexChanged(object sender, EventArgs e)

//refresh button

private void button1_Click(object sender, EventArgs e)

lbNames.Items.Clear();

Process netUtility = new Process();

netUtility.StartInfo.FileName = "net.exe";

netUtility.StartInfo.CreateNoWindow = true;

netUtility.StartInfo.Arguments = "view";

netUtility.StartInfo.RedirectStandardOutput = true;

netUtility.StartInfo.UseShellExecute = false;
netUtility.StartInfo.RedirectStandardError = true;

netUtility.Start();

StreamReader streamReader = new StreamReader(netUtility.StandardOutput.BaseStream,


netUtility.StandardOutput.CurrentEncoding);

string line = "";

while ((line = streamReader.ReadLine()) != null)

if (line.StartsWith("\\"))

lbNames.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());

/*if (lbNames.ItemHeight == 0)

* lbNames.Items.Add("No systems connected..\nPleace check LAN");

}*/

streamReader.Close();

netUtility.WaitForExit(1000);

//connect button

private void button2_Click(object sender, EventArgs e)

if (lbNames.SelectedItem == null) //error message box

Form3 frm = new Form3();


frm.Show();

else

frm1 = new Form2(portNo, lbNames.SelectedItem.ToString());

frm1.Show();

portNo++;

void lbNames_MouseDoubleClick(object sender, MouseEventArgs e)

int index = this.lbNames.IndexFromPoint(e.Location);

if (index != System.Windows.Forms.ListBox.NoMatches)

frm1 = new Form2(portNo, lbNames.SelectedItem.ToString());

frm1.Show();

portNo++;

Form 2.cs

//code for the second form which is the actual chatting part

//library classes

using System;
using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Net;

using System.Net.Sockets;

using System.IO;

using System.Threading;

namespace Chat_App

public partial class Form2 : Form

Thread thdUDPServer;

int portNo;

string serverName;

public Form2(int port, string name)

portNo = port;

serverName = name;

InitializeComponent();

}
//thread for synchronous data transfer

public void serverThread()

UdpClient udpClient = new UdpClient(portNo);

while (true)

IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, portNo);

Byte[] recieveBytes = udpClient.Receive(ref RemoteIpEndPoint); //receiving data

string returnData = Encoding.ASCII.GetString(recieveBytes);

lbConnections.AppendText(serverName + ":" + returnData.ToString() + "\n");

private void Form2_Load(object sender, EventArgs e)

chatBox.Focus();

thdUDPServer = new Thread(new ThreadStart(serverThread)); //thread object for sockets

thdUDPServer.Start();

private void lbConnections_TextChanged(object sender, EventArgs e)

private void chatBox_TextChanged(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)

UdpClient udpClient1 = new UdpClient(); //socket object for data transfer using UDP protocol

udpClient1.Connect(serverName, portNo);

Byte[] sendBytes = Encoding.ASCII.GetBytes(chatBox.Text); //encoding

if (chatBox.TextLength != 0)

string hostName = Dns.GetHostName().ToString();

udpClient1.Send(sendBytes, sendBytes.Length); //sending to remote user

lbConnections.AppendText(hostName + ":" + chatBox.Text + "\n");

lbConnections.ScrollToCaret();

chatBox.Clear();

chatBox.Focus();

private void copyToolStripMenuItem_Click(object sender, EventArgs e)

Clipboard.Clear();

chatBox.Copy();

}
//cut, copy, paste commands

private void copyToolStripMenuItem1_Click(object sender, EventArgs e)

Clipboard.Clear();

lbConnections.Copy();

private void cutToolStripMenuItem_Click(object sender, EventArgs e)

Clipboard.Clear();

chatBox.Cut();

private void pasteToolStripMenuItem_Click(object sender, EventArgs e)

chatBox.AppendText(Clipboard.GetText());

Form3.cs

//code for error message

using System;

using System.Collections.Generic;

using System.ComponentModel;
using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Chat_App

public partial class Form3 : Form

public Form3()

InitializeComponent();

private void label1_Click(object sender, EventArgs e)

private void button1_Click(object sender, EventArgs e)

Form3.ActiveForm.Close();

Potrebbero piacerti anche