Designing of pre-stressed concrete with an internet based software
©2002
Studienarbeit
85 Seiten
Zusammenfassung
Inhaltsangabe:Abstract:
The increasing interest in the Internet of the recent years results in a growing number of users as well as improved network infrastructure, quality and performance. This is the basis for a new kind of software, which is running via the Internet. That means the software is installed an a server connected to the Internet and accessed and executed by a remote client. Such Internet based software provides several benefits. Once distributed by a server, Internet based software is available world-wide and depending on its implementation it can be executed without previous installation on the client machine.
Further software updates and patches are not distributed to the users any more. Only the server has to be updated and the new version is available to all users immediately. For commercial use it is not necessary that customers buy the software any more, they download and pay only the module they need or they pay just for every access with the server application. It is also possible to place a high-performance or application specific computer at the server side and provide computation time for special tasks to the users.
Inhaltsverzeichnis:Table of Contents:
Abstract1
Chapter 1: Introduction1
Chapter 2: Project Objective1
Chapter 3: Methodology2
3.1An Overview of TCP/IP Protocols and the Internet2
3.1.1Definition of Internet2
3.1.2What is TCP/IP?2
3.1.3The TCP/IP Protocol Architecture2
3.1.4The Network Interface Layer2
3.1.5The Internet Layer2
3.1.6The Transport Layer Protocol (TCP)3
3.1.7The TCP/IP Application Layer3
3.1.8TCP/IP Paket3
3.1.9TCP/IP Transport Diagram4
3.2What are Ports?4
3.3What is a Socket?4
3.4Programming Languages5
3.4.1Advantages of Java5
3.4.1.1Java is Distributed6
3.4.1.2Java is Interpreted6
3.4.1.3Java is Architecture Neutral and Portable6
3.4.2Advantages of C++6
3.4.2.1C++ is High Performanced6
3.4.2.2C++ is Platform independent with QT7
3.4.2.3C++ is a popular Language7
3.4.2.4C++ is a powerful Language7
3.4.3Solution of our Task7
Chapter 4: Detail Description of the Program8
4.1Class Overview of the Program8
4.1.1UML Illustration of the Java Client8
4.1.2Detail Descriptionof the Java Client8
4.1.2.1AppletClient Class8
4.1.2.2NetClient Class10
4.1.2.3SocketOpener Class10
4.1.2.4ClientInputStream Class10
4.1.2.5ClientOutputStream Class11
4.1.3UML Illustration of the QT Server11
4.1.4Detail Descriptionof the QT Server12
4.1.4.1Main […]
The increasing interest in the Internet of the recent years results in a growing number of users as well as improved network infrastructure, quality and performance. This is the basis for a new kind of software, which is running via the Internet. That means the software is installed an a server connected to the Internet and accessed and executed by a remote client. Such Internet based software provides several benefits. Once distributed by a server, Internet based software is available world-wide and depending on its implementation it can be executed without previous installation on the client machine.
Further software updates and patches are not distributed to the users any more. Only the server has to be updated and the new version is available to all users immediately. For commercial use it is not necessary that customers buy the software any more, they download and pay only the module they need or they pay just for every access with the server application. It is also possible to place a high-performance or application specific computer at the server side and provide computation time for special tasks to the users.
Inhaltsverzeichnis:Table of Contents:
Abstract1
Chapter 1: Introduction1
Chapter 2: Project Objective1
Chapter 3: Methodology2
3.1An Overview of TCP/IP Protocols and the Internet2
3.1.1Definition of Internet2
3.1.2What is TCP/IP?2
3.1.3The TCP/IP Protocol Architecture2
3.1.4The Network Interface Layer2
3.1.5The Internet Layer2
3.1.6The Transport Layer Protocol (TCP)3
3.1.7The TCP/IP Application Layer3
3.1.8TCP/IP Paket3
3.1.9TCP/IP Transport Diagram4
3.2What are Ports?4
3.3What is a Socket?4
3.4Programming Languages5
3.4.1Advantages of Java5
3.4.1.1Java is Distributed6
3.4.1.2Java is Interpreted6
3.4.1.3Java is Architecture Neutral and Portable6
3.4.2Advantages of C++6
3.4.2.1C++ is High Performanced6
3.4.2.2C++ is Platform independent with QT7
3.4.2.3C++ is a popular Language7
3.4.2.4C++ is a powerful Language7
3.4.3Solution of our Task7
Chapter 4: Detail Description of the Program8
4.1Class Overview of the Program8
4.1.1UML Illustration of the Java Client8
4.1.2Detail Descriptionof the Java Client8
4.1.2.1AppletClient Class8
4.1.2.2NetClient Class10
4.1.2.3SocketOpener Class10
4.1.2.4ClientInputStream Class10
4.1.2.5ClientOutputStream Class11
4.1.3UML Illustration of the QT Server11
4.1.4Detail Descriptionof the QT Server12
4.1.4.1Main […]
Leseprobe
Inhaltsverzeichnis
ID 5671
Kollinger, Michael: Designing of pre-stressed concrete with an internet based software / Michael
Kollinger - Hamburg: Diplomica GmbH, 2002
Zugl.: München, Technische Universität, Studienarbeit, 2002
Dieses Werk ist urheberrechtlich geschützt. Die dadurch begründeten Rechte, insbesondere die
der Übersetzung, des Nachdrucks, des Vortrags, der Entnahme von Abbildungen und Tabellen,
der Funksendung, der Mikroverfilmung oder der Vervielfältigung auf anderen Wegen und der
Speicherung in Datenverarbeitungsanlagen, bleiben, auch bei nur auszugsweiser Verwertung,
vorbehalten. Eine Vervielfältigung dieses Werkes oder von Teilen dieses Werkes ist auch im
Einzelfall nur in den Grenzen der gesetzlichen Bestimmungen des Urheberrechtsgesetzes der
Bundesrepublik Deutschland in der jeweils geltenden Fassung zulässig. Sie ist grundsätzlich
vergütungspflichtig. Zuwiderhandlungen unterliegen den Strafbestimmungen des
Urheberrechtes.
Die Wiedergabe von Gebrauchsnamen, Handelsnamen, Warenbezeichnungen usw. in diesem
Werk berechtigt auch ohne besondere Kennzeichnung nicht zu der Annahme, dass solche
Namen im Sinne der Warenzeichen- und Markenschutz-Gesetzgebung als frei zu betrachten
wären und daher von jedermann benutzt werden dürften.
Die Informationen in diesem Werk wurden mit Sorgfalt erarbeitet. Dennoch können Fehler nicht
vollständig ausgeschlossen werden, und die Diplomarbeiten Agentur, die Autoren oder
Übersetzer übernehmen keine juristische Verantwortung oder irgendeine Haftung für evtl.
verbliebene fehlerhafte Angaben und deren Folgen.
Diplomica GmbH
http://www.diplom.de, Hamburg 2002
Printed in Germany
Contents
Contents of tables
Abstract ... 1
Chapter 1 : Introduction... 1
Chapter 2 : Project Objective ... 1
Chapter 3 : Methodology... 2
3.1
An Overview of TCP/IP Protocols and the Internet... 2
3.1.1
Definition of Internet... 2
3.1.2
What is TCP/IP?... 2
3.1.3
The TCP/IP Protocol Architecture ... 2
3.1.4
The Network Interface Layer ... 2
3.1.5
The Internet Layer... 2
3.1.6
The Transport Layer Protocol (TCP) ... 3
3.1.7
The TCP/IP Application Layer ... 3
3.1.8 TCP/IP
Paket ... 3
3.1.9
TCP/IP Transport Diagram ... 4
3.2
What are Ports? ... 4
3.3
What is a Socket? ... 4
3.4 Programming
Languages... 5
3.4.1 Advantages
of
Java... 5
3.4.1.1 Java is Distributed ... 6
3.4.1.2 Java
is
Interpreted... 6
3.4.1.3 Java is Architecture Neutral and Portable ... 6
3.4.2 Advantages
of
C++ ... 6
3.4.2.1 C++ is High Performanced... 6
3.4.2.2 C++ is Platform independent with QT ... 7
3.4.2.3 C++ is a popular Language ... 7
3.4.2.4 C++ is a powerful Language ... 7
3.4.3
Solution of our Task... 7
Chapter 4 : Detail Description of the Program ... 8
4.1
Class Overview of the Program ... 8
4.1.1
UML Illustration of the Java Client ... 8
4.1.2
Detail Description of the Java Client ... 8
4.1.2.1 AppletClient
Class... 8
4.1.2.2 NetClient
Class... 10
4.1.2.3 SocketOpener
Class... 10
4.1.2.4 ClientInputStream
Class... 10
4.1.2.5 ClientOutputStream
Class ... 11
4.1.3
UML Illustration of the QT Server ... 11
4.1.4
Detail Description of the QT Server ... 12
4.1.4.1 Main
Application... 12
4.1.4.2 NetServer
Class ... 12
4.1.4.3 ServerSocket
Class... 12
4.1.4.4 ClientSocket
Class... 13
4.2 Data
Handling ... 13
4.2.1
Data Handling Windows versus Unix (Little Endian Big Endian) ... 13
4.2.2 Streams ... 14
4.2.2.1 What is a Stream?... 14
4.2.2.2 Text Versus Binary Streams... 14
4.2.2.3 Solution for our Task... 14
4.2.3 Characters... 15
I
Contents
4.2.3.1 ASCII ... 15
4.2.3.2 Unicode ... 15
4.2.3.3 UTF-8 ... 15
4.2.4
Data Handling with Characters in Java ... 16
4.2.5
Data Handling with Characters in QT... 17
4.2.6
Functions Overview : Sending Data from Java Client to QT Server ... 19
4.2.7
Functions Overview : Sending Data from QT Server to Java Client ... 20
Chapter 5 : Demonstration of the Result ... 21
5.1 Example... 21
5.2 Input ... 23
5.3 Status
Bar ... 24
Chapter 6 : Conclusions... 25
6.1
Program before after... 25
6.2 Advantages ... 25
6.3 Disadvantages... 25
Chapter 7 : Furtherwork... 26
References ... 27
Appendix A : Implementation... 27
Appendix B : ASCII Character Codes ... 28
Appendix C : Unicode Character Code... 29
Appendix D : ClientOutputStream Class Reference ... 30
Appendix E : ClientInputStream Class Reference... 38
Sourcecode : AppletClient ... 48
Sourcecode : QTServer... 70
II
Designing of pre-stressed concrete with an internet based software
Abstract
This paper presents an example of an Internet based software using the Socket API
and the TCP/IP protocol.
Chapter 1 : Introduction
The increasing interest in the Internet of the recent years results in a growing number
of users as well as improved network infrastructure, quality and performance. This is the basis
for a new kind of software, which is running via the Internet. That means the software is
installed an a server connected to the Internet and accessed and executed by a remote client.
Such Internet based software provides several benefits. Once distributed by a server, Internet
based software is available world-wide and depending on its implementation it can be
executed without previous installation on the client machine. Further software updates and
patches are not distributed to the users any more. Only the server has to be updated and the
new version is available to all users immediately. For commercial use it is not necessary that
customers buy the software any more, they download and pay only the module they need or
they pay just for every access with the server application. It is also possible to place a high-
performance or application specific computer at the server side and provide computation time
for special tasks to the users.
Chapter 2 : Project Objective
The aim of this software is to split an existing program for designing pre-stressed
concrete into two parts, the computational and the user interface part. This two part should
communicate via Internet und get network functionality.
For the development of the network connection suitable libraries in Java and C++ are
available to implement the TCP/IP based communication. Concerning the current planning,
the server programs should be implemented in C++ and the platform independent clients in
Java.
· User interactions
· Vizualize data
· Compute data
Communication
Client
· User interactions
· Vizualize data
Server
· Compute data
1
Designing of pre-stressed concrete with an internet based software
Chapter 3 : Methodology
3.1 An Overview of TCP/IP Protocols and the Internet
3.1.1 Definition of Internet
The Internet is a worldwide system of computer networks - a network of
networks in which users at any one computer can, if they have permission, get
information from any other computer.
Today, the Internet is a public, cooperative, and self-sustaining facility
accessible to hundreds of millions of people worldwide. Physically, the
Internet uses a portion of the total resources of the currently existing public
telecommunication networks. Technically, what distinguishes the Internet is its
use of a set of protocols called TCP/IP (for Transmission Control
Protocol/Internet Protocol). Two recent adaptations of Internet technology, the
intranet and the extranet, also make use of the TCP/IP protocol.
3.1.2 What is TCP/IP?
TCP\IP or Transmission Control Protocol \ Internet Protocol is a stack or
collection of various protocols. A protocol is basically the commands or
instructions using which two computers within a local network or the Internet
can exchange data or information and resources.
3.1.3 The TCP/IP Protocol Architecture
The TCP\ IP Suite is a stacked suite with various layers stacked on each other,
each layer looking after one aspect of the data transfer. Data is transferred from
one layer to the other. The Entire TCP\ IP suite can be broken down into the
below layers-:
3.1.4 The Network Interface Layer
The Network layer owns the responsibility of delivering data between different
systems in different interconnected networks.
3.1.5 The Internet Layer
2
The Internet Protocol, provides services that are roughly equivalent to the
Network Layer. This service is sometimes referred to as unreliable because the
network does not guarantee delivery nor notify the end host system about
packets lost due to errors or network congestion. IP datagrams contain a
Designing of pre-stressed concrete with an internet based software
message, or one fragment of a message, that may be up to 65,535 bytes in
length. IP does not provide a mechanism for flow control.
IP Header:
3.1.6 The Transport Layer Protocol (TCP)
The Transport layer is responsible for the reliable transfer of data between
systems. It manages the communication session including flow control,
ordering of information, error detection, and recovery of data.
TCP Header:
3.1.7 The TCP/IP Application Layer
All of the capabilities of networking begin in the Application layer. File
transfer, messaging, web browsing, and other applications are in this layer.
Each such application will appropriately invoke processing of data for
transmission through well-defined interfaces to layer(s) below this one.
3.1.8 TCP/IP
Paket
3
Designing of pre-stressed concrete with an internet based software
3.1.9 TCP/IP Transport Diagram
3.2 What are Ports?
On computer and telecommunication devices, a port (noun) is generally a
specific place for being physically connected to some other device, usually
with a socket and plug of some kind. Typically, a personal computer is
provided with one or more serial ports and usually one parallel port. The serial
port supports sequential, one bit-at-a-time transmission to peripheral devices
such as scanners and the parallel port supports multiple-bit-at-a-time
transmission to devices such as printers.
In programming, a port is a "logical connection place" and specifically, using
the Internet's protocol, TCP/IP, the way a client program specifies a particular
server program on a computer in a network. Higher-level applications that use
TCP/IP such as the Web protocol, Hypertext Transfer Protocol, have ports with
preassigned numbers. These are known as "well-known ports" that have been
assigned by the Internet Assigned Numbers Authority (IANA). Other
application processes are given port numbers dynamically for each connection.
When a service (server program) initially is started, it is said to bind to its
designated port number. As any client program wants to use that server, it also
must request to bind to the designated port number.
Port numbers are from 0 to 65536. Ports 0 to 1024 are reserved for use by
certain privileged services. For the HTTP service, port 80 is defined as a
default and it does not have to be specified in the Uniform Resource Locator
(URL).
Some examples of reserved Port numbers:
FTP
21
Telnet
23
HTTP
80
3.3 What is a Socket?
Sockets is a method for communication between a client program and a server
program in a network. A socket is defined as "the endpoint in a connection."
Sockets are created and used with a set of programming requests or "function calls"
sometimes called the sockets application programming interface (API). The most
common sockets API is the Berkeley UNIX C interface for sockets. Sockets can
also be used for communication between processes within the same computer.
4
Designing of pre-stressed concrete with an internet based software
This is the typical sequence of sockets requests from a server application in the
"connectionless" context of the Internet in which a server handles many client
requests and does not maintain a connection longer than the serving of the
immediate request:
This is the typical sequence of sockets requests from a server application (C
language system) in the "connectionless" context of the Internet in which a server
handles many client requests and does not maintain a connection longer than the
serving of the immediate request:
socket()
|
bind()
|
recvfrom()
|
(wait for a sendto request from some client)
|
(process the sendto request)
|
sendto (in reply to the request from the client...for example, send an
HTML file)
A corresponding client sequence of sockets requests would be:
socket()
|
bind()
|
sendto()
|
recvfrom()
Sockets can also be used for "connection-oriented" transactions with a somewhat
different sequence of C language system calls or functions.
3.4 Programming
Languages
3.4.1 Advantages of Java
The idea of Java is pretty simple software that works just about anywhere.
From day one, Java was developed to run on any platform or device that
supported Java, and, Java was designed with networks in mind. Networks like
the Internet. Networks that require applications to be portable, modular and
secure all areas which Java excels. In addition, Java simplifies computing for
both users and for the companies building distributed software applications.
Users don't have to worry about installing and running new applications on
their computers. Companies benefit from the ability to write one piece of code
that can be used on many different platforms.
Today, the most visible examples of Java are nimble, interactive programs
called "applets", which download and run in real time in web browsers,
computers and other devices.
5
Designing of pre-stressed concrete with an internet based software
Microsystems, the creators of Java, define the programming language of Java
as follows:
A simple, small, object-oriented, distributed, interpreted, robust, secure,
architecture neutral, portable, high-performance, multithreaded, and dynamic
language.
3.4.1.1 Java is Distributed
Distributed refers to the relationship between the objects of the Java code
and whether these objects are on remote or local systems. Since Java is a
distribute language, this means that Java applications can be as easily
accessed from the web via a URL as they are on a local system. As a
distributed language, Java has an extensive library of routines built into
it, which will allow Java application and applets to cope easily with
TCP/IP protocols like HTTP. A significant savings can be realized by
utilizing the existing HTTP infrastructure of a potential client.
3.4.1.2 Java is Interpreted
This is a critical benefit of Java. Although only about 20% of the Java
code is interpreted by the browser, it's this 20% that is critical. Java's
security and it's ability to run cross platform are due to this interpreted
20% is handled locally by the browser. The cross platform benefit is one
of the strongest features of Java. Compare this to the relatively low reach
of player based systems. In addition, this platform independence also
extends to the development environment, allowing Mac, PC and Unix
developers to work together on a single piece of software. In addition, the
interpretation feature of Java also facilitates security, allowing the
browser to ascertain whether a certain application is potentially harmful
prior to invoking it. This level of security is a benefit recognized by users
of the web making Java more widely accepted than other application
delivery methods. The security of Java is also what makes it so robust.
3.4.1.3 Java is Architecture Neutral and Portable
The Java language was designed to run on any platform that is running a
Java compatible browser. The advantage here is in the development of
the application. If a program were developed in another language,
Destiny would have to develop the application multiple times for each
platform it wished to support. This is very costly and time consuming.
With Java, we develop once, and the application can be used on the
widest possible combination of platforms. This results in a lower
development cost, a much quicker time to market, and a much larger
available audience.
3.4.2 Advantages of C++
3.4.2.1 C++ is High Performanced
C++ is not a interpreted language like Java. C++ codes are compiled in
absolute code (machine-code) and runs with a higher performance as
Java. This is a very big advantage for civil engineering, because many
applications in civil engineering have a numerical solution and this
caused usually very calculating-intensive programs.
6
Designing of pre-stressed concrete with an internet based software
3.4.2.2 C++ is Platform independent with QT
QT is a multiplatform GUI software toolkit written in C++. QT was not
designed for networks and has not the high network functionality like
Java, but there is also a cross platform benefit for Mac, Windows and
Unix.
3.4.2.3 C++ is a popular Language
The vast majority of application developers working in the market today
know C++ programming. It means that C++ applications can be
developed very quickly, because a lot of source code are existing and
there are a high amount of literature and information available.
3.4.2.4 C++ is a powerful Language
C++ is used in professional application development because of its
immense flexibility and power. What you can accomplish with C++ is
limited only by your imagination. C++ is used for projects as diverse as
operating systems (UNIX), word processors, graphics (Windows NT user
interface), spreadsheets, database (Oracle) and even compilers for other
languages.
3.4.3 Solution of our Task
Java is designed for network programming and have the vast support and
highest functionality for writing Internet based software. C++ is a very
powerful and fast language and is most suitable for applications in civil-
engineering. For the client is primarily the platform independence and
portability important. Java applets are running in real time in a web browser. In
every computer nowadays are a web browser installed and therefore there is no
installation necessary to run a applet on any computer. The benefits of Java
mentioned above shows, that Java applets are preferable for the Client. For the
server there is the computational speed and the flexibility important. But also
the platform independence is important for easy implementing of the server
program in other operating systems, therefore using QT should be the best
decision.
7
Designing of pre-stressed concrete with an internet based software
Chapter 4 : Detail Description of the Program
4.1 Class Overview of the Program
4.1.1 UML Illustration of the Java Client
Internet
4.1.2 Detail Description of the Java Client
4.1.2.1 AppletClient Class
The AppletClient class organizes the graphical user interface and visualize
the input and output data. For the Internet communication there will be
created an instance of the NetClient class.
The graphical user interface and the Internet based part are strictly
separated. therefore the network functionality can be implemented easily
in any existing Java software.
Following steps are necessary to implement the network ability:
· Create an instance of the classes NetClient, ClientInputStream and
ClientOutputStream.
The ClientOutputStream class is necessary to save the input data of the
user to a buffered byte array before transferring this data as a data
8
Designing of pre-stressed concrete with an internet based software
packet to the NetClient. The ClientInputStream class allowed us to get
the input data of the server.
· Before the NetClient class can communicate with the QT server, there
is required to open a Socket.
The static function connectToHost asks the NetClient to open an
Internet socket to the server with the specified IP-address strHost
and the port number nPort. The number 5000 is the timeout of the
socket. During the procedure of the NetClient trying to connect to the
server, the program will be blocked. If there are troubles with the
network or Internet, than the connection to the server may takes very
long. With the timeout of 5000 the procedure will be stopped after 5
second.
· The main idea of this program is not only sending data to the server,
compute this data and send back the result, but also to give some
options to interact with the server. There will be send a data header
ahead to the input data, with it the programmer (or also the user) can
operate the server application. Two variables are provided for this
interactions, the variables sCmdGroup and sCmd. The parameter
sCmdGroup perhaps gives general commands to the server and the
sCmd may specified commands. For example could return the
QTServer only the present server version to the client, if the
sCmdGroup is 0. With the server version, the client can interact in a
right way and may disable or enable some functionality for the user.
The parameter bByteOfChar makes it possible to define the character
byte size. That is maybe necessary to reduce the character data size in
order to increase the performance and speed of the program.
bByteOfChar=1 is defined as a 1-byte ASCII code and
bByteOfChar=2 provides the 2-byte Unicode.
9
Designing of pre-stressed concrete with an internet based software
4.1.2.2 NetClient Class
The NetClient class manages the Internet based part of the program
and communicate with the QT server. In this class the function
connectToHost is declared and try to open the static method of the
OpenSocket class openSocket. Now everything seems to become very
intricately, but this is the only way to set a timeout to make sure, that the
program are not blocked during the connection procedure to the server.
All the communication with the server will be proceeded in the NetClient
class. By calling the static method send the NetClient will send the
header information and the input data to the server.
For the first call of send, there is no SessionID specified and the
NetClient will send 0 as SessionID to the server. The 0 is a indicator for
the server, that it´s the first call of this client and send back the client a
unique SessionID. The NetClient save this unique SessionID from the
server and will send from now on this ID as the first information in the
header. In this way the server can save local data and informations from
the client and the client doesn´t have to sent the same data twotimes.
4.1.2.3 SocketOpener Class
The SocketOpener class has the only functionality to open a socket to
the specified IP-address and port number and pass the socket stream to the
NetClient.
4.1.2.4 ClientInputStream Class
During the computing procedure, the NetClient will exchange data and
commands with the QT server. In the ClientInputStream there are
some functions to make the handling with data more comfortable. The
10
Designing of pre-stressed concrete with an internet based software
next chapter will show, that data handling between two different
programming languages causes a lot of troubles, because each language
organize the data in a unequal way. Especially the character values with
the vast number of different types produce a lot of problems for the
programmer.
The ClientInputStream is derived from the DataInputStream
class of Java and has there full functionality. Addition to this functions,
there are some addition methods available (e.g. readString()), which
are concerted with the communication between Java and QT applications.
For more information look at chapter 4.2
data handling
and the appendix E:
ClientInputStream Class Reference
.
4.1.2.5 ClientOutputStream Class
According to the description of the ClientInputStream class, the
ClientOutputStream class has the same functionality, just with the
distinction, that with the ClientInputStream you read data from the
socket stream and with the ClientOutputStream you write data to the
socket stream.
The ClientOutputStream is derived from the DataOutputStream
class and the ByteArrayOutputStream class and support the full
range of functions of this classes. As well as the ClientInputStream
class, the ClientOutputStream class has addition methods especially
for exchanging data from the Java client to the QT server. For more
information look at chapter 4.2
data handling
and the appendix D:
ClientOutputStream Class Reference
.
4.1.3 UML Illustration of the QT Server
Internet
11
Designing of pre-stressed concrete with an internet based software
4.1.4 Detail Description of the QT Server
4.1.4.1 Main Application
The QTServer organizes the computational part and return the result to
the AppletClient. For the Internet communication there will be
created an instance of the NetServer class.
The main function is very simple. It is just necessary to create the instance
of the NetServer class and call the method connectToPort() of the
NetServer class with a specific port number.
4.1.4.2 NetServer Class
The NetServer class organizes the Internet part of the server. If the
main function calls the method connectToPort(), there will be
created and instance of the ServerSocket class. The constructor of the
ServerSocket class will create itself an instance of a
QServerSocket and bind the QTServer to the specific port.
4.1.4.3 ServerSocket Class
The ServerSocket class is deviated of the QServerSocket and
have there full functionality. The main task of the ServerSocket is to
listen to the specific port and accept incoming requests of AppletClients.
For any incoming request, the ServerSocket will create an instance of
a ClientSocket in a own thread. That instance is now responsible for
the communication with that client.
12
Designing of pre-stressed concrete with an internet based software
Every ClientSocket get a special SessionID with it the QTServer can
indicate the AppletClient again. The AppletClient itself will save this
SessionID and put it in the data header of the following requests. The
advantages of the SessionID is written in the description of the
NetClient class.
4.1.4.4 ClientSocket Class
The ClientSocket class is deviated of the QSocket class.
The ClientSocket class has the task to open a socket to the
AppletClient and organize the Internet communication. The
ClientSocket runs in a own thread, therefore the data exchange
between server and client is proceeded just in the ClientSocket. The
function readClient() is waiting for incoming data and will run until
the communication is finished. The method bytesAvailable() is
true, until data is send from the AppletClient.
4.2 Data Handling
4.2.1 Data Handling Windows versus Unix (Little Endian Big Endian)
Unix systems store multibyte values in Big Endian order, while Windows
systems store them in Little Endian order. Big Endian stores the high-order
byte at the starting address while Little Endian stores the low-order byte at the
starting address. The low-order byte contains the bits for the lowest possible
values, that is, 0-255, while the high-order byte contains the bits that specify
the large values (that is, 256-65535 in a short integer). (The term endian is
derived from a passage in Jonathan Swift's Gulliver's Travels). Swapping
integer data between computers of different types is a difficult problem unless
you convert the information into ASCII characters.
13
Designing of pre-stressed concrete with an internet based software
Example in C:
Windows:
Unix:
Big Endian
Little Endian
4.2.2 Streams
4.2.2.1 What is a Stream?
A stream is a sequence of characters. More exactly, it is a sequence of
bytes of data. A sequence of bytes flowing into a program is an input
stream; a sequence of bytes flowing out of a program is an output stream.
The major advantage of streams is that input/output programming is
device (keyboard, disk, and so on). The program "see" input/output as a
continuous stream of bytes no matter where the input is coming or going
to.
4.2.2.2 Text Versus Binary Streams
Streams fall into two modes: text and binary. A text stream consists only
of characters, such as text data being sent to the screen. Text streams are
organized into lines, which can be up to 255 characters long and are
terminated by an end-of-line, or newline, character. Certain characters is a
text stream are recognized as having special meanings, such as the newline
character.
A binary stream can handle any sort of data including, but not limited to,
text data. Bytes of data in a binary stream are not translated or interpreted
in any special way; they are read and written exactly as is. Binary streams
are used primarily with disk files.
4.2.2.3 Solution for our Task
Text streams are usually converted in a special format. This may caused
some problems if you are using two different programming languages for
14
Designing of pre-stressed concrete with an internet based software
writing and reading data in a stream as in our task. Binary streams are not
translated or interpreted in any special format, therefore you can handle the
data exactly in this way you want. On the other side, the binary required
less space for the same data as text streams and increase the performance of
the program.
4.2.3 Characters
4.2.3.1 ASCII
ASCII (American Standard Code for Information Interchange) is the most
common format for text files in computers and on the Internet. In an ASCII
file, each alphabetic, numeric, or special character is represented with a 7-
bit binary. In particular, Unicode extends ASCII, so the first 128 Unicode
cells coincide with the ASCII characters. ASCII defines 128 characters, of
which 33 (namely, the first 32 and the last one) are control characters.
See also table of ASCII characters: Appendix B.
4.2.3.2 Unicode
Unicode (UCS-2 ISO 10646) is a 16-bit character encoding that contains
all of the characters (2
16
= 65,536 different characters total) in common use
in the world's major languages. The Universal Character Set provides an
unambiguous representation of text across a range of scripts, languages and
platforms. It provides a unique number, called a code point (or scalar
value), for every character, no matter what the platform, no matter what the
program, no matter what the language. The Unicode standard is modeled
on the ASCII character set. Since ASCII's 7-bit character size is inadequate
to handle multilingual text, the Unicode Consortium adopted a 16-bit
architecture which extends the benefits of ASCII to multilingual text.
Unicode characters are consistently 16 bits wide, regardless of language, so
no escape sequence or control code is required to specify any character in
any language. Unicode character encoding treats symbols, alphabetic
characters, and ideographic characters identically, so that they can be used
simultaneously and with equal facility. Computer programs that use
Unicode character encoding to represent characters but do not display or
print text can (for the most part) remain unaltered when new scripts or
characters are introduced.
4.2.3.3 UTF-8
The Unicode Standard (ISO 10646) defines a 16-bit universal character set
which encompasses most of the world's writing systems. 16-bit characters,
however, are not compatible with many current applications and protocols
that assume 8-bit characters (such as the Web) or even 7-bit characters
(such as mail), and this has led to the development of a few so-called UCS
transformation formats (UTF), each with different characteristics. Unicode
provides for a byte-oriented encoding called UTF-8 that has been designed
for ease of use with existing ASCII-based systems. UTF-8 is the Unicode
Transformation Format that serializes a Unicode code point as a unique
sequence of one to four bytes. The UTF-8 encoding allows Unicode to be
used in a convenient and backwards compatible way in environments that,
15
Details
- Seiten
- Erscheinungsform
- Originalausgabe
- Erscheinungsjahr
- 2002
- ISBN (eBook)
- 9783832456719
- ISBN (Paperback)
- 9783838656717
- DOI
- 10.3239/9783832456719
- Dateigröße
- 1.1 MB
- Sprache
- Englisch
- Institution / Hochschule
- Technische Universität München – Informatik, Informatik
- Erscheinungsdatum
- 2002 (Juli)
- Schlagworte
- internetprogrammierung sockets java applet tcp/ip
- Produktsicherheit
- Diplom.de