Академический Документы
Профессиональный Документы
Культура Документы
CONTENTS
1 INTRODUCTION 2
2 SCOPE OF PROJECT 3
3 SYSTEM REQUIREMENTS 4
5 PROJECT ANALYSIS 6
7 OUTPUT SCREENS 10
8 PROJECT CODING 15
9 PROJECT TESTING 25
10 CONCLUSION 26
1
INTRANET CHATTING DOCUMENTATION
INTRODUCTION
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
3
INTRANET CHATTING DOCUMENTATION
SYSTEM REQUIREMENT
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—
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’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.
Operating system—Windows 7
Others—Java Netbeans
4
INTRANET CHATTING DOCUMENTATION
5
INTRANET CHATTING DOCUMENTATION
PROJECT ANALYSIS
6
INTRANET CHATTING DOCUMENTATION
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
8
INTRANET CHATTING DOCUMENTATION
9
INTRANET CHATTING DOCUMENTATION
OUTPUT SCREENS
Program Started
10
INTRANET CHATTING DOCUMENTATION
11
INTRANET CHATTING DOCUMENTATION
12
INTRANET CHATTING DOCUMENTATION
Communication starts
13
INTRANET CHATTING DOCUMENTATION
14
INTRANET CHATTING DOCUMENTATION
PROJECT CODING
/**
* @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() {
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");
.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;
/**
* @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>
@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(){
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 {
public MessageTransmitter() {
}
@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
OUTPUT TEST
The successful output screens are placed in the output screens section
above with brief explanation about each screen.
FUTURE IMPROVEMENT
25
INTRANET CHATTING DOCUMENTATION
CONCLUSION
Even though this application has been developed with the users own Protocols,
this can be used in an Intranet based organization.
26