Вы находитесь на странице: 1из 26

INTRANET CHATTING DOCUMENTATION

CONTENTS

SNO TOPIC PAGE NO

1 INTRODUCTION 2

2 SCOPE OF PROJECT 3

3 SYSTEM REQUIREMENTS 4

4 HARDWARE AND SOFTWARE 5


SPECIFICATION

5 PROJECT ANALYSIS 6

6 DATA FLOW DIAGRAMS 8

7 OUTPUT SCREENS 10

8 PROJECT CODING 15

9 PROJECT TESTING 25

10 CONCLUSION 26

1
INTRANET CHATTING DOCUMENTATION

INTRODUCTION

PURPOSE OF THE PROJECT

This Project Entitled as ‘INTRANET CHATTING’ is used basically for chatting


purpose with the remote clients or users on Internet or local networks. Here in this
project we have peer to peer system through which we can communicate with any
person on the network we only require socket address.
.

We have to give Socket address as input. Socket address contain IP address as well as
port address. IP address of the system can be find through command ipconfig in windows
system. For port address we have ephemeral port numbers ranging from 1024 to 65535.
Any port numbers can be chosen as sending port and receiving port.

2
INTRANET CHATTING DOCUMENTATION

SCOPE OF THE PROJECT

We can use “INTRANET CHATTING” for following activities:


 To exchange information and converse with friends and family.
 To participate in group discussions through public news bulletin board.
 Access business while at home.

 At any given point of time, up-to-date information is provided.

3
INTRANET CHATTING DOCUMENTATION

SYSTEM REQUIREMENT

3.1 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

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.

3.2 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—Java Netbeans

4
INTRANET CHATTING DOCUMENTATION

HARWARE AND SOFWARE SPECIFICATION

 The proposed system should have the following features.


 The Chat Interface should be as simple as possible so that they can be configured
even by a naïve user.
 Server should be able to create facility for one to one communication .
 Users can able to communicate with multiple users at the same time.

5
INTRANET CHATTING DOCUMENTATION

PROJECT ANALYSIS

1) STUDY OF THE SYSTEM


This application can be mainly divided into three modules:
1. Main Class file
2. GUI file
3. Networking Modules
This project “INTRANET CHATTING” is mainly peer to peer system in which both
the user inputs the Socket address of other user and they communicate with each
other.

2) INPUT AND OUTPUT:

We have to give Socket address as input. Socket address contain IP address as


well as port address. IP address of the system can be find through command
ipconfig in windows system. For port address we have ephemeral port numbers
ranging from 1024 to 65535. Any port numbers can be chosen as sending port and
receiving port.

6
INTRANET CHATTING DOCUMENTATION

3) PROCESS MODEL USED WITH JUSTIFICATION

The model used here is a SPIRAL MODEL. This Model demands a direct
consideration of technical risk at all stages of the project and if properly applied it
reduces risk before they become problematic, hence it becomes easier to handle a
project when using this kind of model where in the end user can evaluate the program
at the end of each stage and suggest modification if required. In this way the Risk
Management of Project is carried out efficiently through Spiral model.

7
INTRANET CHATTING DOCUMENTATION

1) DATA FLOW DIAGRAMS

8
INTRANET CHATTING DOCUMENTATION

9
INTRANET CHATTING DOCUMENTATION

OUTPUT SCREENS

Program Started

10
INTRANET CHATTING DOCUMENTATION

User 1 entered the socket address of user 2

11
INTRANET CHATTING DOCUMENTATION

User 2 enters Socket address of user1

12
INTRANET CHATTING DOCUMENTATION

Communication starts

13
INTRANET CHATTING DOCUMENTATION

14
INTRANET CHATTING DOCUMENTATION

PROJECT CODING

1. Main class Chaaat


package chaaat;
import chaaat.gui.MainScreen;
/**
*
* @author dell pc
*/
public class Chaaat {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
MainScreen screen = new MainScreen();
screen.show();
}

15
INTRANET CHATTING DOCUMENTATION

2. MainScreen.java

package chaaat.gui;

import chaaat.network.MessageListener;
import chaaat.network.MessageTransmitter;
import chaaat.network.WritableGUI;

/**
*
* @author manthanhd
*/
public class MainScreen extends javax.swing.JFrame implements WritableGUI {

/**
* Creates new form MainScreen
*/
public MainScreen() {
initComponents();
}

/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

ipTextField = new javax.swing.JTextField();


targetPort = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
chat = new javax.swing.JTextArea();
message = new javax.swing.JTextField();
sendButton = new javax.swing.JButton();
listenButton = new javax.swing.JButton();
receivePort = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

targetPort.setText("1234");

16
INTRANET CHATTING DOCUMENTATION

chat.setColumns(20);
chat.setRows(5);
jScrollPane1.setViewportView(chat);

sendButton.setText("Send");
sendButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendButtonActionPerformed(evt);
}
});

listenButton.setLabel("Listen");
listenButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
listenButtonActionPerformed(evt);
}
});

receivePort.setText("8877");

jLabel1.setText(" Host IP Address");

jLabel2.setText(" Guest Port NO");

jLabel3.setText("Host Port NO");

jLabel4.setText("Enter Message Below");

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1,
javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(message)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sendButton))

17
INTRANET CHATTING DOCUMENTATION

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(listenButton)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
84, Short.MAX_VALUE)
.addComponent(receivePort))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 30, Short.MAX_VALUE)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 281,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(ipTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 269,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(targetPort)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
80, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
152, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()

18
INTRANET CHATTING DOCUMENTATION

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(ipTextField,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(targetPort, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(listenButton)
.addComponent(receivePort, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(9, 9, 9)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
181, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel4)
.addGap(5, 5, 5)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(message, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sendButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);

pack();
}// </editor-fold>

19
INTRANET CHATTING DOCUMENTATION

MessageListener listener;

private void listenButtonActionPerformed(java.awt.event.ActionEvent evt) {


listener = new MessageListener(this, Integer.parseInt(receivePort.getText()));
listener.start();
}

private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
MessageTransmitter transmitter = new MessageTransmitter(message.getText(),
ipTextField.getText(), Integer.parseInt(targetPort.getText()));
transmitter.start();
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional)
">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

20
INTRANET CHATTING DOCUMENTATION

java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainScreen().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JTextArea chat;
private javax.swing.JTextField ipTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton listenButton;
private javax.swing.JTextField message;
private javax.swing.JTextField receivePort;
private javax.swing.JButton sendButton;
private javax.swing.JTextField targetPort;
// End of variables declaration

@Override
public void write(String s) {
chat.append(s + System.lineSeparator());
}
}

21
INTRANET CHATTING DOCUMENTATION

3.MessageListener.java

package chaaat.network;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author manthanhd
*/
public class MessageListener extends Thread {

ServerSocket server;
int port = 8877;
WritableGUI gui;

public MessageListener(WritableGUI gui, int port){


this.port = port;
this.gui = gui;
try {
server = new ServerSocket(port);
} catch (IOException ex) {
Logger.getLogger(MessageListener.class.getName()).log(Level.SEVERE, null,
ex);
}
}

public MessageListener(){
try {
server = new ServerSocket(port);
} catch (IOException ex) {
Logger.getLogger(MessageListener.class.getName()).log(Level.SEVERE, null,
ex);
}
}

@Override
public void run() {
Socket clientSocket;

22
INTRANET CHATTING DOCUMENTATION

try {
while((clientSocket = server.accept()) != null){
InputStream is = clientSocket.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
if(line != null){
gui.write(line);
}
}
} catch (IOException ex) {
Logger.getLogger(MessageListener.class.getName()).log(Level.SEVERE, null,
ex);
}
}
}

23
INTRANET CHATTING DOCUMENTATION

4.MessageTransmitter.Java

package chaaat.network;
import java.io.IOException;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author manthanhd
*/
public class MessageTransmitter extends Thread {

String message, hostname;


int port;

public MessageTransmitter() {
}

public MessageTransmitter(String message, String hostname, int port) {


this.message = message;
this.hostname = hostname;
this.port = port;
}

@Override
public void run() {
try {
Socket s = new Socket(hostname, port);
s.getOutputStream().write(message.getBytes());
s.close();
} catch (IOException ex) {
Logger.getLogger(MessageTransmitter.class.getName()).log(Level.SEVERE,
null, ex);
}
}
}

24
INTRANET CHATTING DOCUMENTATION

PROJECT TESTING

COMPILING TEST

It was a good idea to do our stress testing early on, because it gave us time to fix
some of the unexpected deadlocks and stability problems that only occurred when
components were exposed to very high transaction volumes.

EXECUTION TEST

This program was successfully loaded and executed. Because of good


programming there were no execution errors. The complete performance of the project
“INTRANET CHATTING” was good.

OUTPUT TEST

The successful output screens are placed in the output screens section
above with brief explanation about each screen.

FUTURE IMPROVEMENT

1. This project can be enhanced by implementing different protocols and can be


made more useful for varied clients according to the requirements of the client, it
can also possible in future that each client in this globe has his own customized
“INTRANET CHATTING”.

2. It can be enhanced by making it more secure by implemen

25
INTRANET CHATTING DOCUMENTATION

3. It can be enhanced in the field of Video Conferencing.

CONCLUSION

Even though this application has been developed with the users own Protocols,
this can be used in an Intranet based organization.

1. This system was developed so that people can exchange information as


well as converse with each other.
2. Through this system people can access chat rooms globally.
3. The system is interactive and friendly.
4. Entire system is fully automatic to the clients and satisfies the clients
request
5. Especially the system is more useful to the technical people when the need
for sending pictures, images it is solved through WHITE BOARD
UTILITY OF “INTRANET CHATTING”.

26

Вам также может понравиться