Beruflich Dokumente
Kultur Dokumente
Contents:
1. Introduction
2. System Design
3. Software Specification
4. Forms
Source code
Out Put
5. Conclusion
6. Future Enhancement
7. Bibliography.
INTRODUCTION
INTRODUCTION
In this post, a group chat application using Multicast Socket (Java Platform SE 7) class
is discussed. A Multicast Socket is a (UDP) Datagram Socket, with additional
capabilities for joining “groups” of other multicast hosts on the internet.
users to enter amount to be converted (say currency in Dollars), and display the
converted amount (say currency in Euro).
Save the file as GroupChat.java and compile it using java c and then run the program
using two command line arguments as specified. A multicast host is specified by a class
D IP address and by a standard UDP port number. Class D IP addresses are in the
range 224.0.0.0 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and
should not be used.
SYSTEM DESIGN
SYSTEM DESIGN
The term system is one that is universally used. A system is a purposeful set of
interrelated components that form an integrated whole and work together to achieve some
objective. Systems are usually hierarchical and so include other systems. These other systems are
called sub-systems. Some systems share common characteristics, including:
1. A system has structure, it contains parts or components that are directly or indirectly
related to each other.
2. A system has behavior, it contains processes that transform inputs into outputs.
3. A system has interconnectivity, the partsand processes are connected by structural and/or
behavioral relationships.
4. Structure and behavior of a system may be decomposed via sub-systems and sub-
processes to elementary parts and process steps.
The technical computer-based systems are systems that include hardware and software
components. Socio-technical systems include one or more technical systems but also include
knowledge of how the system should be used to achieve some broader objective. This means that
these systems have defined operational processes, include people who operate the system, are
governed by organizational policies and rules and may be affected by external constraints such as
national laws and regulatory policies.
Software engineering is critical for the successful development of complex, computer based
socio-technical systems. Software engineer should not simply be concerned with the software
itself but they should also have a broader awareness of how that software interacts with other
hardware and software systems and how it is supposed to be used by end users.
The complexity of relationships between the components in a system means that the system is
more than simply the sum of its parts. It has properties that are properties of the system as a
whole. There are two types of emergent properties of system:
1. Functional properties. These properties appear when all the parts of a system work
together to achieve some objective. For example, when an alarm system turns on the siren
it is due to the co-operation between its components.
2. Non-functional properties. These properties are related to the behaviour of the system in
its operational environment. Examples of non-functional properties are reliability,
performance, safety and security for computer-based systems.
SOFTWARE SPECIFICATION
SOFTWARE SPECIFICATION
The software specification document enlist all necessary requirements that are required for the
project development. To device the requirement we need to have clear and through understanding
of the project team and customer.
1 Hardware Specification
System : I3 Processor.
Ram : 4 GB
2 Software Specification
IDE : Eclipse
SOURCE CODE
Source code:
import java.net.*;
import java.io.*;
import java.util.*;
public class GroupChat
{
private static final String TERMINATE = "Exit";
static String name;
static volatile boolean finished = false;
public static void main(String[] args)
{
if (args.length != 2)
System.out.println("Two arguments required: <multicast-host> <port-number>")
else
{
try
{
InetAddress group = InetAddress.getByName(args[0]);
int port = Integer.parseInt(args[1]);
Scanner sc = new Scanner(System.in);
System.out.print("Enter your name: ");
name = sc.nextLine();
MulticastSocket socket = new MulticastSocket(port);
socket.joinGroup(group);
Thread t = new Thread(new
ReadThread(socket,group,port));
if(message.equalsIgnoreCase(GroupChat.TERMINATE))
{
finished = true;
socket.leaveGroup(group);
socket.close();
break;
}
message = name + ": " + message;
byte[] buffer = message.getBytes();
DatagramPacket datagram = new
DatagramPacket(buffer,buffer.length,group,port);
socket.send(datagram);
}
}
catch(SocketException se)
{
System.out.println("Error creating socket");
se.printStackTrace();
}
catch(IOException ie)
{
System.out.println("Error reading/writing from/to socket");
ie.printStackTrace();
}
}
}
}
class ReadThread implements Runnable
{
private MulticastSocket socket;
private InetAddress group;
private int port;
private static final int MAX_LEN = 1000;
ReadThread(MulticastSocket socket,InetAddress group,int port)
{
this.socket = socket;
this.group = group;
@Override
public void run()
{
while(!GroupChat.finished)
{
byte[] buffer = new byte[ReadThread.MAX_LEN];
DatagramPacket datagram = new
DatagramPacket(buffer,buffer.length,group,port);
String message;
try
{
socket.receive(datagram);
message = new
String(buffer,0,datagram.getLength(),"UTF-8");
if(!message.startsWith(GroupChat.name))
System.out.println(message);
}
catch(IOException e)
{
System.out.println("Socket closed!");
}
}
}
}
OUTPUT
KLS GOGTE INSTITUTE OF TECHNOLOGY
MCA PROGRAMME
BELAGAVI
Page 13
GROUPCHATING
CONCLUSION
Grouping chating that the people are using, they will always find ways to
connecting the people in a grouping is a wise thing to check the different foreign exchange
options they have beforehand.
FUTURE ENHANCEMENT
FUTURE ENHANCEMENT
The project “CURRENCY CONVERTOR” . We can take only one output in current
situation. In future we can make to take more than one output in one attempt.
BIBLIOGRAPHY:
www.google.com
www.w3.school.com