6. Implementation - Free

braintreesmileΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μέρες)

433 εμφανίσεις


BRIENS Olivier

BSc (Hons) Computing

1





Communication
Using Java










BRIENS Olivier

BSc (Hons) Computing

2








Context:





Java provides access to sockets programming which
allows communication between computers. The purpose of
this project is to develop a program which allows real
-
time
communication e.g. as an on
-
line
chat or meeting tool.






Tutor: John Polton


Supervisor: Ken Croston




BRIENS Olivier

BSc (Hons) Computing

3

Contents


1. Introduction

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4

2. Java and Network comprehension

. . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5

2.1 Java
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5

2.2 Rapid network comprehension
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . .

6

3. Development Sotwares

. . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7

3.1 Poseidon
. . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
7

3.2 NetBeans
. . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7

4. Methodology

Tools:

UML
. . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. .

9

4.1 Object Notion

. . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9

4.2 Object Methods

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9

4.3 UML History

.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10

5. On

Line chat or Meetind Tools examples
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

5.1 Skype

. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11

5.2 Msn Messenger
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

5.3 Ventrilo

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . .
13

6. Implementation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14

6.1 Uml Diagram of Classes

. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . .
14

6.2 Steps of implementation

.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17

7
.

Critical and Evaluation of the Produc
t

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19

7.1 Evaluatio
n of the connection to a distant host


7.2
Evaluation of the written
communication

between two distant computer

7.3 Evaluation of the vocal
communication

between two distant computers


8. User’s

Manual

. . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . .

. . . . . . .
20

8.1

First Requiremen
t

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

8.2

Server Use
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
20


8.3 Client Use

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22

9 Conclusion

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . .
31

10 References

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32

Acknowledgments




BRIENS Olivier

BSc (Hons) Computing

4

1. Introduction



The project consists in
developing

a program which permits communication

on
the network. Oral communication via computers is today more and more wanted. Not
only does it allow communication between two people but also between two groups of
people, for example a meeting. In practice, this kind of program would be useful to
fore
ign students of NEWI who want to communicate with their families and friends
who remained in their country of origin (SPAIN, DEUTCHLAND, FRANCE...
)
without

paying for huge telephone bills. Considering the reality, would telephone
disappear with the
appeara
nce

of this kind of program? The answer is no, but it will
surely evolve.



The programming language was already chosen by the supervisor. It is Java.
You will see a short presentation of this Object Language. The only point left was to
find out was the d
ifferent technical difficulties especially functional ones of a project
like this one. To
succeed in

developing

such program, one needs to be competent not
only in programming but also in the network world.




I will introduce the different programs alrea
dy existing. Some inspired me for
the user interface that would be, as for me, as simple and intuitive as possible.



I
chose

to analyze my project with the
methodological

tools that are UML ones.
UML/JAVA
is, for

me, a very good duet to develop this kind
of program. To model the
final diagram, I used the Poseidon program.



The program should work on the network using the system of communication
TCP/IP.


I
developed

my program using whether Windows or Linux, thanks to a multi
platform development
program:

NetBeans.



The limits of the project are on the configuration of the networks. Depending on
the way the networks are configured, the program will be more or less able to send and
receive the packets containing the voice.



BRIENS Olivier

BSc (Hons) Computing

5

2. Java
and network comprehensio
n



In this section I will explain some about the environment of my project
. After
that we have a look through the
different

soft wares

that I used.


2.1 Java


Java

is a technology composed of a programming language object oriented and
of an execution envi
ronment. Previously called Oak
, it has been created by

James
Gosling and Patrick Naughton in Sun Microsystems, with the support of Bill Joy.



Java languag
e was officially introduces on

Mai 23 th 1995 in the
SunWorld
.



Java's concept is based on the

Java la
nguage, the Java Virtual Machine and the
API Java

The f
irst caracteristic, the object oriented,
referred

to a modern method of
programming

and language conception. Its main caracteristic is to encapsulate in one
single logic entity (Class) a group of data

(Properties) and the functions that deal with it
(Methods). The source code becomes in that way easier reusable.


Other mechanisms

such as the Inheritance, allow to make the most of the
caracteristics of a Class
previously

written (most of the time by som
eone else) in its
own program without even to know the intern running. One only sees the Interface (the
main functions).


This paradigm of
programming

aims to make the huge projects easier to manage,
to improve the quality of the programs, and to reduce th
e number of failure in a project.

I
ndependent language facing the platform


The second caracteristic of this language, the independent language towards the
platform, means that the Java
written

programs should work on different kinds of
computing materials
. A programmer should be able to writ
e a program only one time,
and
be able to use it with any computer. This is possible in compiling the source code of
a Java program in a intermediate pseudo code called Java
bytecode


standard machine

BRIENS Olivier

BSc (Hons) Computing

6

instructions aimed to a virtual processor. The code is then executed by the
implementation of this virtual machine (
JVM
), a native code
written

prog
ram on the
target material which
translates

the Java pseudo code in one usable for the concerned
material. Moreover, libraries are provided to supply the access to the own target
machine
functionalities
--

as for the graphics or the network


in one unifie
d manner.
Java language also provides a support to the programs with several threads.

Here is the example of a program called
Hello world

, a Java written
typical one
:

public class HelloWorld {


pu
blic static void main(String[] args) {


System.out.println("Hello world!");


}

}



2.2

Rapid
Network comprehension





There are some protocols (understanding a protocol like a way of
communication) to be mentioned:




Internet Protocol (IP): proto
col used to send and receive packages from
the source to the destination.




Transport Control Protocol (TCP): protocol to have control of the
transmissions, used to manage process.




User Datagram Protocol (UDP): protocol that lets to send a message a
messag
e from a computer to an application which is executed in other
computer.


Network

has several administrations groups who undertake the task of the well working.




BRIENS Olivier

BSc (Hons) Computing

7

3. Development
soft
wares



In this section I will have a look through the soft wares that I h
ave used
for the development of my project.




3
.
1

Poseidon


Poseidon for UML is a software which permits to model the UML stucture of a
software. As advancing in the project, the created allow to rightly implement the source
code.
The intuitive interface

makes Poseidon the quickest UML tool to master, freeing
you to focus solely on your model. A wealth of available features enhances productivity
from the start without getting in the way. Poseidon for UML, with its outstanding price
-
performance ratio, is t
he clear choice for software engineering.

Poseidon society
provides an Evaluate Key to test this software. I used the Poseidon PE 3.0 for my
project.









BRIENS Olivier

BSc (Hons) Computing

8

3.2

NetBeans


I used NetBeans IDE 4.0
to develop

my project
.

“NetBeans is an open
-
source project

dedicated to providing rock solid software
development products (such as NetBeans IDE and NetBeans Platform) that address the
needs of developers, users and the businesses who rely on NetBeans as a basis for their
products. The NetBeans project is also a
vibrant community where people from just
about any country you can think of, have the ability to ask questions, make a wide
variety of

contribution

and ultimately share in the success of our products.

In June 2000 NetBeans was made

open Sourc
e by Sun Micr
osystems,
which
remains the project sponsor

The two base products are

NetBeans IDE and NetBeans Platform
. Both products
are free for commercial and non
-
commercial use
.”

http://www.netbeans.org/
























BRIENS Olivier

BSc (Hons) Computing

9

4
. Methodology
Tools:

UML


Definition:


UML (
Unified
Modelling

Language)

is a mean to model an issue in a standard
way. This language is born from the melting of several methods already existing. It has
become from now on, the clear reference

in terms of

object modelling
, to such point that
you need to know it to get a
developing

object job.

4.1 The object notion


The oriented object
programming

consists in modelizing with a computer, a
whole of elements from a part of the real world, which is called
doma
ine

in one
computing entities whole. These computing entities are called
objects
. They are
computing data gathering tha
t

main caracteristics of
the real world: height, color,.
.

The difficulty of this modelization is to create an abstract representation, w
ith an object
form, of entities realistically existing: a dog, a car, a bulb..., or virtually: public welfare,
time...

4.2 The object methods


The object modelization creates a computing representation of the real world
elements we are interested into, wi
thout worrying about the implementation, which
means
independently

from a
programming

language. So it is a matter of determining the
attended objects, and to isolate their data and the functions they use. To do so, methods
were finalized. From 1970 to 1990
, many analysists perfected oriented object
approaches

so well that in 1994, more than 50 object methods already existed.
However
, only three methods really emerged:



The
OMT

method of
Rumbaugh



The
BOOCH'93

method of
Booch



The
OOSE

method of
Jacobson

(
Obj
ect Oriented Software Engineering
)


BRIENS Olivier

BSc (Hons) Computing

10

From 1994, Rumbaugh and Booch (joined in 1995 by Jacobson) gathered their efforts to
finalize the
unified method 0.8
, blending the advantages of each of the previous
methods.

From the 1.0 version, the unified method becam
e
UML

(
Unified
Modelling

Language
),
A universal way for the object modelization.

Beware:

UML is not a method inasmuch as it does not represent any step. As
such UML is a formalism of object modelization. The word
method

abusively used in
the following page
s is not to be understood as a «

step

».

4.3 UML History:

UML 1.0 is OMG

(Object Management Group
) submissive in January 1997, but is only
accepted in November 1997, in its 1.1 version. It is from that date that UML has
become an international standard

He
re is a sum
-
up of the evolution of this modelization
language:




In 1995: Unified Méthod 0.8 (blending the Booch'93 method and the OMT)



In 1995: UML 0.9 (blending OOSE method)



In 1996: UML 1.0 (submitted to the OMG)



In 1997: UML 1.1 (standardized by the OMG
)



In 1998: UML 1.2



In 1999: UML 1.3



In 2000: UML 1.4



In 2003: UML 1.5



The last details can be downloaded on the OMG website.




BRIENS Olivier

BSc (Hons) Computing

11

5
.
On
-
Line chat or Meeting Tools examples




5
.1
SKYPE:



Thanks to this program you can phone and chat
free of charge on the In
ternet.


Skype is the new
phenomenon

produced by the creators of KaZaA. After the fashion of
KaZaA or Joltid, Skype uses the P2P (peer
-
to
-
peer) technology, so that you can
connect with other people, not anymore to share files but to phone and chat free of

charge, in a quick time with your relatives and friends. This leading
-
edge technology is
of simpl
e use.

The P2P (peer
-
to
-
peer)

technology is a fully dealt system. It is an in live time system of

communication and sharing data
. Thus, on the network each
computer is used as a
server for the others. The servers are architectured as equals. Contrary to
client
-
server
architecture, it does not need a dedicated server.


















BRIENS Olivier

BSc (Hons) Computing

12

5.2 MSN Messenger



MSN Messenger permits you to chat in a live time written

way, sometimes
through videos with your relatives and friends. Faster than E
-
Mail, it is an ideal tool to
chat and the perfect answer to your impossibility to be present.













BRIENS Olivier

BSc (Hons) Computing

13

5
.3 Ventrilo


Ventrilo 2.3.0 is the next evolutionary step of Voice over

IP (VoIP) group
communications software. Ventrilo is also the industry standard by which all others
measure them selves as they attempt to imitate it's features.

By offering surround sound positioning and special sound effects on a per user,
per channel,

per server or global configuration level the program provides each user the
option to fully customize exactly how they wish to hear sounds from other users or
events.

Ventrilo is best known for it's superior sound quality and minimal use of CPU
resources

so as not to interfere with day to day operations of the computer or during
online game competitions. It is also preferred for the simple user interface that any first
time computer user can very quickly learn because the most commonly used features
are i
mmediately visible and can be activated with a single click of the mouse.










BRIENS Olivier

BSc (Hons) Computing

14

6
. Implementation



6
.1
UML
diagram of Classes
:

Package
Overview:















BRIENS Olivier

BSc (Hons) Computing

15

UML Diagram of the Client

package
:




BRIENS Olivier

BSc (Hons) Computing

16


UML Diagram Server Package
:













BRIENS Olivier

BSc (Hons) Computing

17

6
.2
Steps

of implementation
:


The programing language was already chosen. So I need to find out technicals
solutions for the program to work on the local network. I shared the project in two
distinct stages:


6.2.1 First
step
:

The written communication




This
stage consisted in implementing an application which would allow to
control the whole of the clients. These clients would connect on a server and then they
choose to write whether private or public message, that is to say they can send message
to all the c
lients.




6.2.2 Second step
:

The oral communication



The possible solutions were of different levels of
difficulties:




The first solution, the simplest, was to allow the user to record his voice on a
sound file, then to send it to a second user who co
uld listen to it. I started to develop that
solution, this explains why there is an audio player in the program. This audio player
allows you to listen to sound files but also to record your voice.



The second solution, which I found out, was the use of T
CP segments
«

containing

» sound between the server and the client. With this in mind, I used the
first stage of my project as a support to this new function. In the final solution, there is a
general server which allows several people to chat, and each cl
ient has the possibility to
create a server to receive oral messages from the other ones. So the functioning scheme
becomes a bit more complicated, because the program produces a main server and also
a server for each of its client.





BRIENS Olivier

BSc (Hons) Computing

18






Functional
sche
me:








BRIENS Olivier

BSc (Hons) Computing

19

7
. Critical Evaluation of the Product



Thanks to this project you can communicate from one computer to another,
sending private and public messages. The oral communication is also implemented but
has some problems: the sound quality is not alw
ays very good and the time that elapsed
between two messages is a bit too long. Most of the tests were done on my machine.
The tests of the network only happened in the end on two machines related on a local
network. In this part I will explain how the tes
ts happened and the facts I concluded on:


7.1
Evaluation

of the connection to a distant
host:


The connection on a distant machine, which plays the rôle of the server, works
well. When the distant machine doesn't exist, the program let the user knows. Thu
s, this
part has been well implemented.


7.2 Evaluation of the
written

communication between

two distant
machines:


The
written

communication works very well. The time elapsed to be
transferred

on the screen is very little. So this part is valid.


7.3 Ev
aluation of the
vocal

communication between

two distant
machines:



Theoral communication works but has some problems: First, if the user has not a
correctly configured sound card, the program does not indicate to the user that there is a
problem. Secondly
, if the distant machine is on a network using a proxy, the machine
trying to send sound
packets

failed. The time elapsing between two answers is also a
problem: it is rather long and the person using the distant machine waits for several
seconds before he

can hear it. A phone like conversation is thus impossible. The last
problem lies in the sound quality: it is understandable but not good quality






BRIENS Olivier

BSc (Hons) Computing

20

8
. User’s manual

8
.1 First Requirement


Make sure that Java Virtual Machine is well installed (if not, dow
nload
JVM:

http://java.sun.com/downloads/
index.html)

and that the network is turned on.


In order to be able to use the Client, you need to create a server accessible by
the network.

8
.2 Server Use

It is of simple use. The only thing to do is to launch the

server.

The following window opens :



The server gives you useful informations for the next stage.See IpHost.


BRIENS Olivier

BSc (Hons) Computing

21


The server displays informations like, for example, the list of the connected clients:



To close the server, click on Menu
-
> Quit









BRIENS Olivier

BSc (Hons) Computing

22

8
.3 Client Use

Start a client. The window
opens:












BRIENS Olivier

BSc (Hons) Computing

23

8.3.1)

Connection to the
server:


To connect to the server, click on Network
-
> Connect



A pop
-
up window
opens:





BRIENS Olivier

BSc (Hons) Computing

24

Enter the IP of the server.

You will find the IP of the server in the IP Host
.
A
n example
of IP of a server : 83.156.164.124

or
192.168.0.10


The value by default is localhost.

..

Enter your User Name
. A
n example of User
Name:

John
;
Victor

For example
:


If you want to cancel, push on Cancel

Click on Connect

-
> The client is connec
ting to the server. In the case the connection failed, a pop
-
up
window opens:


You can retry or abort your attempt to connect.





BRIENS Olivier

BSc (Hons) Computing

25


In the case the connection succeded: the client displays the list of the other clients
already connected to the server:










BRIENS Olivier

BSc (Hons) Computing

26

8.3.2
)
Communicate (write and talk) with the other:


8.3.2.
i ) Communicate with everybody in the same time :

Y
ou can send messages to all the clients in the same time. Type your message in
front of «

Send a message to all

» then click on «

send

». T
he message will appear in the
right side of the software.









BRIENS Olivier

BSc (Hons) Computing

27

8.3.2.
ii ) Communicate in private with a single client :

To communicate in private with a single client, you have to click on the name
displayed in the left side of the software. A pop
-
up wi
ll then opens for both users.


You can send him messages. Type your message and then push on «

Send

».



You can communicate with him. To do so you need to click on «

Speak with User
-
Name

». In doing so you can speak with the other user. If you want to
stop speaking
with him push on «

Stop

».






BRIENS Olivier

BSc (Hons) Computing

28

8.3.3
) Use of the audio
player:


To launch the audio player, click on AudioPlayer. A pop
-
up window
opens:



This program allows you to listen to sound files of the following format: mp3,
ogg, wma. It also permi
ts you to record your voice. You will then be able to listen to
your sound file thanks to this player. To listen to a sound file, push the «

Open

» button.
If you want to record sound, push the «

Start

» button. The software asks you to name
your sound fil
e. When you have done it, you can begin to record yourself. The record is
finalized when clicking on the «

Stop

» button.









BRIENS Olivier

BSc (Hons) Computing

29

8.3.4
) Disconnection of the server :


To disconnect to the server, you need to click on Netwrok
-
>Disconnect










BRIENS Olivier

BSc (Hons) Computing

30

8.3.5
) Q
uit the
client:



To q
uit the client, push on Menu
-
>Quit








BRIENS Olivier

BSc (Hons) Computing

31

9
. Conclusion



The aim of the project was to develop an application to make possible the
communication on the networks. As for me, the written communication is a real
success. The oral commu
nication though, could be improved, especially the sound
quality.



I had to learn the Java language and to efficiently use the developing tools. My
UML knowledge were, I think, sufficient to correctly develop this application.



The bigger problems I met
on this project were to find enough time during my
2004
-
2005 school year when I also studied in France at the IUP of VANNES (56) to get
my Licence. Another difficulty was to test my program on a network I would have
created myself, as I used to have only o
ne computer. So, most of the tests happened on a
localhost. I think I ahve acquired a good knowledge on the graphical interface, Java
application and UML modelisation of a software, sciences.




F
inally the aim and objectives of this project has been achie
ve in great part, and
I have entertained a lot doing it, and I will carry improving my knowledge in
the
network applications.

BRIENS Olivier

BSc (Hons) Computing

32

10
. References





David Flanagan
, 2000
, Java in a Nutshell
, third edition
,

EDITIONS O’REILLY, Paris,
ISBN 2
-
84177
-
065
-
6




David
Flanagan
, 2001
,
Examples i
n Java in a Nutshell, second edition,
EDITIONS
O’REILLY, Paris, ISBN 2
-
84177
-
137
-
7



Andrew S. Tanenbaum
,2002 ,

Computer Networks, Fourth

edition
,

E
DITION
PEARSON EDUCAITON.INC , ISBN: 0130661023




http://www.netbeans.org/


http://gentleware.com/index.php


http://uml.free.fr/


http://fr.wikipedia.org/wiki/Java_(langage)#Concepts_de_Base


http://www.commentcamarche.net/


http://java.sun.com/






BRIENS Olivier

BSc (Hons) Computing

33






ACKNOWLEDGEMENTS


I would like to thank all

those who have assisted and advised me during the building of
this Research Project, and especially:


My tutor
, John POLTON who was always there to answer my questions.

My supervisor
, Ken CROSTON
.


My friends
, they made possible this project, special ment
ion to: Le
-
goahecVincent and
CHAMPION Carole for their efforts and time spent with me, and overall for their words
of courage when I needed them.


I want to thank as well the rest of my friends and mates for the comments and supports
received.