Sei sulla pagina 1di 128

PSZ 19:16 (Pind.

1/97)

UNIVERSITI TEKNOLOGI MALAYSIA

BORANG PENGESAHAN STATUS TESISυ


JUDUL: CLIENT INITIATED NETWORK INTERNET SPEED TEST
___________________________________________________________________________

MONITORING SYSTEM (CINISTMS)


___________________________________________________________________________

___________________________________________________________________________

SESI PENGAJIAN: 2008 / 2009


______________

Saya AHMAD NAZMI BIN AHMAD NAJIB KAMIL


_________________________________________________________________________
(HURUF BESAR)
mengaku membenarkan tesis (PSM/Sarjana/Doktor Falsafah)* ini disimpan di Perpustakaan
Universiti Teknologi Malaysia dengan syarat-syarat kegunaan seperti berikut:

1. Tesis adalah hakmilik Universiti Teknologi Malaysia.


2. Perpustakaan Universiti Teknologi Malaysia dibenarkan membuat salinan untuk tujuan
pengajian sahaja.
3. Perpustakaan dibenarkan membuat salinan tesis ini sebagai bahan pertukaran antara
institusi pengajian tinggi.
4. **Sila tandakan ( √ )

(Mengandungi maklumat yang berdarjah keselamatan atau


SULIT kepentingan Malaysia seperti yang termaktub di dalam
AKTA RAHSIA RASMI 1972)

TERHAD (Mengandungi maklumat TERHAD yang telah ditentukan


oleh organisasi/badan di mana penyelidikan dijalankan)

√ TIDAK TERHAD

Disahkan oleh

____________________________________ ____________________________________
(TANDATANGAN PENULIS) (TANDATANGAN PENYELIA)

Alamat Tetap:
68-5-5, PANGSAPURI MESRA,
____________________________
JLN. LIM KHOON HUAT,
____________________________ PM. DR. SULAIMAN BIN MOHD NOR
___________________________________________
10460, GEORGETOWN, P. PINANG.
____________________________ Nama Penyelia

Tarikh: 12th MAY 2009


____________________________ 12th MAY 2009
Tarikh: ____________________________

CATATAN: * Potong yang tidak berkenaan.


** Jik a t es is in i S U L I T a t a u T E R H AD , s i la la m p ir k a n s u ra t d ar ip ad a p ih a k
berkuasa/organisasi berkenaan dengan menyatakan sekali sebab dan tempoh tesis ini perlu
dikelaskan sebagai SULIT atau TERHAD .
∗∗∗ Tesis d imaksudk an sebagai tesis bagi Ijazah Dok tor Falsafah d an Sarjan a secara
penyelidikan, atau disertasi bagi pengajian secara kerja kursus dan penyelidikan, atau
Laporan Projek Sarjana Muda (PSM).
i

CLIENT INITIATED NETWORK INTERNET SPEED TEST MONITORING


SYSTEM (CINISTMS)

AHMAD NAZMI BIN AHMAD NAJIB KAMIL

A thesis submitted in fulfillment of the requirements for the

Degree of Bachelor in Computer Engineering

Faculty of Electrical Engineering

Universiti Teknologi Malaysia

MAY, 2009
ii

I declare that this thesis entitled Client Initiated Network Internet Speed Test
Monitoring System (CINISTMS) is the result of my own research except as cited in
the references. The thesis has not been accepted for any degree and is not
concurrently submitted in candidature of any other degree.

Signature : ....................................................

Name : Ahmad Nazmi Bin Ahmad Najib Kamil

Date : 12th May 2009

I certify that i have read this project report, and in my opinion, it is fully adequate, in
scope and quality, as dissertation for the degree of Bachelor of Computer
Engineering.

Signature : ....................................................

Name : Assoc. Prof. Dr. Sulaiman Bin Mohd Nor

Date : 12th May 2009


iii

To my beloved family and Hamidah Binti Hassan


iv

ACKNOWLEDGEMENT

Alhamdulillah, I would like to express my gratitude to Allah s.w.t for


everything since my first breath in this world. My respect also goes to the project
supervisor Assoc. Prof. Dr. Sulaiman Bin Mohd Nor for his supervision and brilliant
comments throughout this two semester completing my final year project.

To my brother Ahmad Haidir Bin Ahmad Najib Kamil, I would like to thank
you for every guide you had gave to me and the truth is your guidance is invaluable.
My deep appreciation also goes to Hamidah Binti Hassan for supporting me from
behind while completing this project.

Last but not least, my true love and deepest thanks goes to my family for
always supporting me and loving me without boundaries.
v

ABSTRACT

This project is about developing a network monitoring system that will


monitor the download rate speed to reach any intranet link or internet link such as
www.utm.my and www.google.com respectively. Overall, this project will consist of
two parts which is the server part and the client part. Both parts will be implemented
on Microsoft Windows operating system and those two parts will play equally an
important roles to determine this project success. The client part will do a test on
download rate speed to reach any intranet or internet link and send the test results to
the server for monitoring purposes and thus this system will be known as Client
Initiated Network Internet Speed Test Monitoring System (CINISTMS). To make the
monitoring system more efficient, this system will show all the download rate speed
test results through a webpage and thus all UTM’s student and staff can view it easily
for further analysis. IIS7 web server was used along with the ASP.NET for webpage
development. The core programming language for this project is C# and the compiler
used is Microsoft Visual Studio 2008. Web services technology has been used for the
client to send data to the server by using SOAP protocol and as the storage element,
this project used Microsoft SQL Server 2005 Express Edition as database.
vi

ABSTRAK

Projek ini berkaitan dengan pembangunan satu sistem pemantauan rangkaian


yang akan memantau kadar muat turun untuk mencapai mana – mana capaian
intranet atau capaian internet seperti www.utm.my dan www.google.com masing –
masing. Secara keseluruhannya, projek ini mengandungi dua bahagian iaitu klien dan
pelayan. Kedua – dua bahagian akan diimplimentasi dalam sistem operasi Microsoft
Windows dan kedua – dua bahagian memainkan peranan yang penting dalam
menentukan kejayaan projek ini. Pada bahagian klien ia akan melakukan satu ujian
untuk menilai kadar muat turun untuk mencapai mana – mana capaian intranet atau
capaian internet dan menghantar keputusan ujian kepada pelayan bagi tujuan
pemantauan dan oleh yang demikian sistem ini akan dikenali sebagai Client Initiated
Network Internet Speed Test Monitoring System (CINISTMS). Untuk menghasilkan
sistem pemantaun yang lebih efisien, sistem ini akan memaparkan semua keputusan
ujian kadar muat turun melalui laman web dan oleh yang demikian kesemua pelajar
dan staf UTM boleh melihatnya dengan mudah untuk tujuan analisis lanjutan.
Pelayan web IIS7 akan digunakan bersama dengan ASP.NET bagi pembangunan
laman web. Asas bahasa aturcara bagi projek ini adalah C# dan pengkompil yang
digunakan ialah Microsoft Visual Studio 2008. Teknologi servis web digunakan
supaya klien dapat menghantar data kepada pelayan menggunakan protokol SOAP
dan sebagai elemen penyimpan, projek ini menggunakan Microsoft SQL Server 2005
Express Edition sebagai pangkalan data.
vii

TABLE OF CONTENTS

PAGE
TITLE PAGE i
DECLARATION ii

DEDICATION iii
ACKNOWLEDGEMENT iv
ABSTRACT v
ABSTRAK vi
TABLE OF CONTENTS vii
LIST OF FIGURES xi

LIST OF TABLES xiii


LIST OF ABBREVIATIONS xiv
LIST OF APPENDICES xvi

CHAPTER 1 : INTRODUCTION
1.0 Introduction 1
1.1 Problem Background 1

1.2 Project Specification 3


1.3 Objective 3
1.3.1 Project Objective 4
1.4 Scope of Work 5
1.4.1 Operating System 6
1.4.2 IDE 6
viii

1.4.3 Database 6
1.4.4 Communication Protocol 7
1.4.5 Core Programming Language 7
1.5 Overview on the Next Chapters 8

CHAPTER 2 : LITERATURE REVIEW


2.0 Introduction 9

2.1 Computer Network 9


2.2 Types of Computer Network 10
2.2.1 LAN 10
2.2.2 WAN 11
2.4 TCP/IP Protocol Suite 12
2.4.1 Link Layer 13

2.4.2 Network Layer 14


2.4.3 Transport Layer 14
2.4.4 Application Layer 14
2.5 Client-Server Model 15
2.5.1 Iterative Server 16
2.5.2 Concurrent Server 17

2.6 Port Numbers 18


2.6.1 Ranges 19
2.7 IIS7 Web Server 20
2.8 Microsoft .NET Framework 22
2.9 ASP.NET Web Development 23
2.10 Web Services 23

2.10.1 XML 24
2.10.2 SOAP 25
2.10.3 UDDI 25
2.11 HTTPWebRequest and HTTPWebResponse 26
ix

CHAPTER 3 : METHODOLOGY
3.0 Introduction 28
3.1 Elaboration Phase 30
3.1.1 Client Side Elaboration Phase 30
3.1.2 Server Side Elaboration Phase 31
3.2 Design Phase 33
3.2.1 Client Side Design Phase 33

3.2.1.1 HTTPWebRequest and HTTPWebResponse 33


3.2.1.2 SOAP 34
3.2.1.3 Client Side Web Services 34
3.2.2 Server Side Design Phase 34
3.2.2.1 HTML 35
3.2.2.2 SQL Command 35

3.2.2.3 Server Side Web Services 35


3.3 Development Phase 36
3.3.1 CINISTMS Windows Application Development 37
3.3.2 CINISTMS Database Webpage Development 43
3.3.3 Database Development 48
3.4 Testing and Implementation Phase 52

3.5 CINISTMS Data Flow 53


3.5.1 Data Flow Between Client’s Windows Application and
Internet Cloud 54
3.5.2 Data Flow Between Client’s Windows Application and
Server’s Webpage 54
3.5.3 Data Flow Between Server’s Webpage and Server’s Database 55

3.6 CINISTMS Flowcharts 56

CHAPTER 4 : RESULTS AND DISCUSSIONS


4.0 Introduction 57
x

4.1 CINISTMS Achievement 57


4.1.1 Client Side Achievement 57
4.1.1.1 Intranet Link Test Results 60
4.1.1.2 Internet Link Test Results 62
4.1.2 Server Side Achievement 63
4.2 Problem Encountered and Solutions 67
4.3 Limitations of CINISTMS 68

CHAPTER 5 : CONCLUSIONS AND RECOMMENDATIONS


5.0 Conclusions 69
5.1 Recommendations 70

REFERENCES 71

APPENDICES 73
xi

LIST OF FIGURES

FIGURES PAGE
1.1 Wi-Fi UTM Network Topology 2
1.2 CINISTMS Objective 5

2.1 LAN Network Diagram 11


2.2 WAN Network Diagram 12
2.3 TCP/IP Four Layers System 13
2.4 Iterative Server Steps 16
2.5 Concurrent Server Steps 17
2.6 Basic Concepts of Web Services 24

3.1 Project Phases 29


3.2 Client Perspective Diagram 31
3.3 Server Perspective Diagram 32
3.4 CINISTMS Design Layout 36
3.5 Microsoft Visual Studio 2008 IDE GUI 37
3.6 New Project Menu 38
3.7 CINISTMS Windows Application Workspace 39

3.8 Solution Explorer with CINISTMS Database Website Project 41


3.9 Add Service Reference Menu 42
3.10 IIS Manager Menu 43
3.11 Add Virtual Directory Menu 44
3.12 New Website Menu 45
3.13 CINISTMS Database Webpage Workspace 46
xii

3.14 Microsoft SQL Server Management Studio Express GUI 48


3.15 Database Interface Menu 49
3.16 SpeedTestLog Table on InternetSpeedTest Database 50
3.17 CINISTMS Data Flow Path 53
3.18 CINISTMS Flowcharts 56
4.1 CINISTMS Windows Application GUI 59
4.2 Intranet Link Test Results 61

4.3 Internet Link Test Results 62


4.4 CINISTMS Database Webpage GUI 63
4.5 Results Obtained on April 15th 2009 65
4.6 Results Obtained on April 15th 2009 for www.utm.my 66
xiii

LIST OF TABLES

TABLES PAGE
2.1 Three Categories of Port Numbers 19
2.2 IIS7 Modules 21

2.3 Microsoft .NET Framework 22


3.1 SpeedTestLog Table 51
4.1 Problems Encountered and Solutions 67
xiv

LIST OF ABBREVIATIONS

API Application Programming Inteface


CICT Center of Information and Communication
Technology
CINISTMS Client Initiated Network Internet Speed Test
Monitoring System

ECMA European Computer Manufacturer Association


FCL Framework Class Library
FTP File Transfer Protocol
GUI Graphical User Interface
HTML Hypertext Markup Language
HTTP Hypertext Transfer Protocol

IANA Internet Assigned Numbers Authority


ICMP Internet Control Message Protocol
IDE Integrated Development Environment
IETF Internet Engineering Task Force
IGMP Internet Group Management Protocol
IIS Internet Information Services
IP Internet Protocol

ISAPI Internet Server Application Programming


Interface
LAN Local Area Network
MSDN Microsoft Developer Network

NNTP Network News Transfer Protocol


OOPS Object-Oriented Programming System
xv

RPC Remote Procedure Call


SGML Standard Generalized Markup Language
SMTP Simple Mail Transfer Protocol
SNMP Simple Network Management Protocol
SOAP Simple Object Access Protocol
SQL Structured Query Language
TCP Transmission Control Protocol

UDDI Universal Discovery Description and Integration


UDP User Datagram Protocol
URL Uniform Resource Locator
UTM Universiti Teknologi Malaysia
WAN Wide Area Network
WSDL Web Services Description Language

W3C World Wide Web Consortium


XML Extensible Markup Language
xvi

LIST OF APPENDICES

APPENDICES PAGE
A CINISTMS WINDOWS APPLICATION SOURCE CODE 73
B CINISTMS DATABASE WEBPAGE SOURCE CODE 84
1

CHAPTER 1

INTRODUCTION

1.0 Introduction

This project was developed to monitor the download rate speed tested by clients
in UTM’s network to any URL. Beside wired at certain location, the internet connection
provided at colleges in UTM is wireless and the service was known as Wi-Fi UTM. The
purpose of this project is to produce software that can be used by UTM’s student to test
their download rate speed to reach any URL while using the internet services.

1.1 Problem Background

Since CICT provides Wi-Fi UTM service at all colleges in UTM, clients that
used this service increased rapidly. One of the main reason why the usage increased is
due to the service itself which is free of charge. After about two years this service has
been provided, clients that used this service which is UTM’s student itself complained
2

that the download rate speed is quite slow to reach the URL that their requested.
However, clients does not know how much or how slow the download rate speed for
them to reach the requested URL. Figure 1.1 below shows the network topology in
UTM.

Central
Server

Firewall

KTC
Firewall

KTDI
Access Point

Access Point

Figure 1.1 Wi-Fi UTM Network Topology


3

1.2 Project Specification

From the problem mentioned in section 1.1, the specification of this project must
be determined in order to make the development process goes swiftly as it can be. The
main purpose of this software is to build software that will allow the client to do a test
on their download rate speed to reach any URL while using the Wi-Fi UTM. After the
test has been executed, the data obtained from the client which are the host’s IP address,
size downloaded from the URL, duration to reach the URL, tested URL, average speed
to reach the URL and date and time of the particular test will be sent to the database
through a webpage that used web services technology.

The client initiated model is used due to the existence of firewall between the
central server and client. Thus, the server cannot fully monitor all its client activities
since the firewall will protect all transaction initiated from the server. Therefore, to
overcome this problem the client initiated model is used to initiate the logical connection
between the client and the server.

1.3 Objective

Defining the objective for this project is very crucial as it will determine the
success of this project. It is important to set a goal before doing something without a
purpose or out of purpose. Hence, the objective of doing this project is to develop
software that will monitor the download rate speed tested on any URL from all clients in
UTM’s college and to show the result through webpage.
4

1.3.1 Project Objective

CINISTMS will have two major components which is the client and the server.
From the client perspective, it will do a test on the download rate speed from both
intranet and internet. Example of intranet link is www.utm.my whereby www.google.com
as an internet link example. The result obtained from the client will be sent to the server
which is a webpage as the monitoring purposes and the client will be implemented on
Microsoft Windows operating system. The data that will be obtained from the client are
the host’s IP address, size downloaded from the URL, duration to reach the URL, tested
URL, average speed to reach the URL and date and time of the particular test.

From the server perspective, a webpage called CINISTMS Database will provide
a service whereby it will store all the data sent by clients which is the service requestor.
Besides providing those services, the webpage will display all the data inside database as
well as for the monitoring purposes. Figure 1.2 shows the architecture of CINISTMS.
5

Server (MS Receive the


Database (MS Windows) result and
SQL Server) store it inside
database and
show it
through
webpage.

Test on
download rate
Firewall
speed and
send the result
to server.
Client (MS Windows)

Figure 1.2 CINISTMS Architecture

1.4 Scope of Work

The work scope will set certain limitations and boundaries for this project. By
doing so, this project can be done without going out of scope. Some of the limitations
are discussed on the following sub section.
6

1.4.1 Operating System

For this project, both client and server will be implemented on Microsoft
Windows operating system since the majority of students in UTM used Microsoft
Windows operating system in their laptops or desktops.

1.4.2 IDE

Microsoft Visual Studio 2008 has been chosen as the IDE for this project and all
coding process will be done within this tool. This tool was developed by Microsoft and
the express edition is freely available on the Microsoft official website.

1.4.3 Database

As for storage elements, Microsoft SQL Server 2005 Express Edition has been
used to store the data of tested download rate speed from clients at the server side. This
software is available along with the purchase of Microsoft Visual Studio 2008 IDE.
7

1.4.4 Communication Protocol

In computer network, it is obvious to know how the computers from different


vendors, size and running on different operating system communicate with each other.
For this project, TCP/IP protocol suite will be used as the communication protocol. In
general, TCP/IP protocol suite consists of four layers which is the link layer, the network
layer, the transport layer and the application layer. Each of these layers has a different
responsibilities and the concept of implementing TCP/IP protocol suite in this project
will be covered throughout the remaining chapter. By having this communication
protocol, client may send the download rate speed tested to the server as monitoring
process.

1.4.5 Core Programming Language

The core programming language for this project is C# and there are some
advantages of using this programming language. C# is a modernized version of C++ and
C# has simplified the syntax by removing some of the complex features of C++. For
example, C# does away with the pointers because direct memory manipulation is not
allowed in C#.
8

1.5 Overview on the Next Chapters

In chapter two, the literature review of this project will be presented whereby all
the concepts and theories used to accomplish this project will be stated clearly such as
the concepts of computer network, client-server model and the Microsoft .NET
framework.

In chapter three, the methodology used to accomplish this project will be


defined. This chapter will include the discussion of each phase on the four developing
process which is the elaboration phase, design phase, development phase, testing and
implementation phase.

In chapter four, the results and discussions of this project will be documented to
shows the achievement of this project on its actual deployment and the discussions based
on the results obtained. Besides that, this chapter will also discuss on the problems
encountered with the solutions and the limitations of this project.

The last chapter will conclude this project and come out with a list of
recommendations for future development of this project.
9

CHAPTER 2

LITERATURE REVIEW

2.0 Introduction

In this chapter, all the theory and concept in making this project come true will
be discussed starting with the definition of a computer network, TCP/IP protocol suite,
IIS7, Microsoft .NET framework, web services and etc.

2.1 Computer Network

From Zacker (2001), a network is a group of computers connected together by


cables or some other medium, but the networking process is anything but simple. When
computers are able to communicate, they can work together in a variety of ways: by
sharing their resources with each other, by distributing the workload of a particular task,
or by exchanging message.
10

2.2 Types of Computer Network

A computer network can be classified into two networks which LAN and WAN.
The following section will discuss about the LAN and WAN network in details.

2.2.1 LAN

From Zacker (2001), a LAN is a group of computers connected by a shared


medium, usually a cable. By sharing a single cable, each computer requires only one
connection and can conceivably communicate with any other computer on the network.
A LAN is limited to a local area by the electrical properties of the cable used to
construct them and by the relatively small numbers of computers that can share a single
network medium. LANs are generally restricted to operation within a single building or,
at most, a campus of adjacent buildings. Some technologies, such as fiber optics, have
extended the range of LANs to several kilometers, but it isn’t possible to use LAN to
connect computers in distant cities, for example. This is the province of the WAN, as
discussed later on the following section. Figure 2.1 shows the LAN network diagram.
11

Figure 2.1 LAN Network Diagram

2.2.2 WAN

From Zacker (2001), a WAN is a collection of LANs, some or all of which are
connected using point-to-point links that span relatively long distances. A typical WAN
connection consists of two routers, one at each LAN site, connected using a long-
distance link such as a leased telephone line. Any computer on one of the LANs can
communicate with the other LAN by directing its traffic to the local router, which relays
it over the WAN link to the other site. Figure 2.2 shows the WAN network diagram.
12

LAN LAN

Copper/
Wireless/
Fiber Optic

Router WAN Router

Figure 2.2 WAN Network Diagram

2.4 TCP/IP Protocol Suite

From Stevens (1999), TCP/IP protocol suite allows computers of all sizes, from
many different computer vendors, running totally different operating systems, to
communicate with each other. Normally, TCP/IP can be considered as four layers
system as shown on figure 2.3.
13

Figure 2.3 TCP/IP Four Layers System

From figure 2.3, it is obvious that each layer has its own task. The next section
will discuss about each layer responsibilities in details.

2.4.1 Link Layer

The link layer, sometimes called the data-link layer or network interface layer,
normally includes the device driver in the operating system and the corresponding
network interface card in the computer. Together they handle all the hardware details
physically interfacing with the cable or whatever type of media is being used.
14

2.4.2 Network Layer

The network layer handles the movement of the packets around the network. IP,
ICMP and IGMP provide the network layer in the TCP/IP protocol suite.

2.4.3 Transport Layer

The transport layer will provide a flow of data between to hosts. There are two
common transport protocol used in the TCP/IP protocol suite which is TCP and UDP.

TCP transport protocol will acknowledge all the packets sent to the server back
to the client. In other words, the client can have the guarantee that all the packets sent to
the server is successfully sent.

On the other hand, UDP transport protocol did not have any guarantee to the
client that the packets sent is successfully received by the server.

2.4.4 Application Layer

The application layer will handle s the details of the particular application such
as FTP, SMTP and SNMP.
15

2.5 Client-Server Model

From Stevens (1999), most networking applications are written assuming one
side is the client and the other the server. The purpose of the application is for the server
to provide some defined service for clients. Therefore, the server can be categorized into
two classes which are iterative or concurrent.
16

2.5.1 Iterative Server

Iterative server only capable of handling one client for each session and the
problem with an iterative server is when the server processes the client request whereby
no other clients are serviced during that time. Figure 2.4 below shows the iterative server
steps.

Figure 2.4 Iterative Server Steps


17

2.5.2 Concurrent Server

Concurrent server has the ability to handle multiple clients in concurrent period
whereby it will start a new server to handle new client’s request. Thus, this is the main
advantages of concurrent server over the iterative server. Figure 2.5 below shows
concurrent server steps.

Figure 2.5 Concurrent Server Steps


18

2.6 Port Numbers

TCP and UDP identify applications using 16-bit port numbers. Servers usually
known by their well-known port numbers such as FTP server provides that service on
TCP port 21. Those services that can be provided by any implementation of TCP/IP
have well-known port numbers between 1 and 1023. The well-known ports are managed
by IANA.

A client usually does not care what port number it uses on its end. All it needs to
be certain is whatever port number it uses is unique on its host.

2.6.1 Ranges

Table 2.1 below shows the range of well known port numbers.

Table 2.1 Three Categories of Port Numbers

Sometimes ports may be used for different applications or protocols that their
official IANA designation.
19

2.7 IIS7 Web Server

From Henrickson and Hofmann (2003), IIS is Microsoft’s suite of applications


for the internet. With support for the web, FTP, NNTP, and SMTP for e-mail, IIS is
much more than just a web server. Because it is fully integrated at the operating system
level, it integrates well with Microsoft .NET applications, and it allows organizations to
add internet capabilities that weave directly into the rest of their infrastructure.

From Khosravi (2008), IIS7 is the latest version of Microsoft web server. IIS7
has gone through significant architectural changes since the last version. The most
notable change for ASP.NET developers is the deep integration of the IIS7 and
ASP.NET framework. This provides both ASP.NET developers and IIS7 administrators
with an integrated programming environment that allows them to implement features
and functionalities that were not possible before.

IIS7 was released along with Windows Vista and features a modular architecture.
Instead of a monolithic server which features all services, IIS7 has a core web server
engine. Modules offering specific functionality can be added to the engine to enable its
features. The advantage of having this architecture is that only the features required can
be enabled and that the functionalities can be extended by using custom modules.

IIS7 will ship with a handful of modules, but Microsoft will make other modules
available online. Table 2.2 shows IIS7 modules.
20

Table 2.2 IIS7 Modules

Writing extensions to IIS7 using ISAPI has been deprecated in favor of the
module API, which allows modules to be plugged in anywhere within the request
processing pipeline. Much of IIS's own functionality is built on this API, and as such,
developers will have much more control over a request process than was possible in
prior versions. Modules can be written using C++, or using the HTTP module interface
from a .NET framework language. Modules can be loaded globally where the services
provided by the module can affect all sites, or loaded on a per-site basis. IIS7 has an
integrated mode application pool where .NET modules are loaded into the pipeline using
the module API, rather than ISAPI. As a result ASP.NET code can be used with all
requests to the server. For applications requiring strict IIS6 compatibility, the classic
application pool mode loads ASP.NET as an ISAPI.

A significant change from previous versions of IIS is that all web server
configuration information is stored solely in XML configuration files, instead of in the
metabase. The server has a global configuration file that provides defaults, and each
virtual web's document root may contain a web.config containing settings that augment
or override the defaults. Changes to these files take effect immediately. This marks a
significant departure from previous versions whereby web interfaces, or machine
administrator access, were required to change simple settings such as default document,
21

active modules and security/authentication. It also eliminates the need to perform


metabase synchronization between multiple servers in a farm of web servers.

IIS7 also features a completely rewritten administration interface that takes


advantage of modern MMC features such as task panes and asynchronous operation.
Configuration of ASP.NET is more fully integrated into the administrative interface.

2.8 Microsoft .NET Framework

From H.M. Deitel et, al. (2004), the Microsoft .NET framework is at the heart of
the .NET strategy. This framework executes applications and web services, contains a
class library (called FCL) and provides many other programming capabilities used to
build .NET applications. Table 2.3 shows the Microsoft .NET framework.

Table 2.3 Microsoft .NET Framework


22

2.9 ASP.NET Web Development

ASP.NET is not just another upgrade or the next version of ASP. It is a unified
web development platform that provides necessary services for developers to build
enterprise web based applications. ASP.NET allows you to use a full featured
programming language such as C# or VB.NET to build web applications easily.
Essentially ASP.NET code comprises of compiled code unlike traditional ASP code
which is interpreted thus making it more efficient in terms of execution speed. OOPS
features in ASP.NET. This helps in easy maintainability and reusability of code. As
mentioned earlier, ASP.NET seamlessly integrates different programming languages
without any fear of compatibility issues for these different languages. The whole idea is
to keep the code separate from its implementation. That is the basic idea behind
Microsoft .NET (http://www.asp101.com/articles/nakul/intronet/default.asp).

2.10 Web Services

From H.M. Deitel et, al. (2004), web services encompass a set of related
standards that can be enable two computer applications to communicate and exchange
data over the internet. The data is passed back and forth using standard protocols such as
HTTP, the same protocol used to transfer ordinary webpage.

Web services operate using open, text-based standards that enable components
written in different languages and on different platforms to communicate. They are
ready-to-use pieces of software on the internet. XML, SOAP, WSDL and UDDI are the
standards on which web services rely. XML is used to create mark up languages and
describe data. XML allows groups of standardize data mark up and formatting. SOAP
23

enables data transfer between distributed systems on a network. WSDL is an XML-


based description language. It is used to describe a web service so that other applications
can understand and access the methods the service provides. UDDI is another XML-
based format that enables developers and businesses to publish and locate web services
on a network. Figure 2.6 below shows the basic concepts of web services.

Figure 2.6 Basic Concepts of Web Services

2.10.1 XML

From H.M. Deitel et, al. (2004), the W3C XML Working Group developed
XML, which is derived from SGML, in 1996. XML is widely supported open
technology for electronic data exchange and storage. XML is actually a language used to
create other mark up languages to describe data in structured manner.
24

2.10.2 SOAP

From H.M. Deitel et, al. (2004), SOAP is an XML-based protocol that allows
applications to communicate easily over the internet using XML documents call SOAP
messages.

A SOAP message contains an envelope, which is a structure that describes a


method call. A SOAP message’s body contains either a request or a response. A request
message’s body contains a RPC, which is a request for another machine to perform a
task. The RPC specifies the method to be invoked and any parameters the method takes.
The application sends the SOAP message via an HTTP POST. A SOAP response
message is an HTTP response document that contains the results from the method call
(e.g., return values, error messages).

2.10.3 UDDI

UDDI is a public registry designed to house information about businesses and


their services in a structured way. Through UDDI, one can publish and discover
information about a business and its web services. This data can be classified using
standard taxonomies so that information can be found based on categorization. Most
importantly, UDDI contains information about the technical interfaces of a business's
services. Through a set of SOAP-based XML API calls, one can interact with UDDI at
both design time and run time to discover technical data, such that those services can be
invoked and used. In this way, UDDI serves as infrastructure for a software landscape
based on web services. In simple words we can say that UDDI is the yellow pages of
web services. As with traditional yellow pages, you can search for a company that offers
25

the services you need, read about the service offered and contact someone for more
information. You can, of course, offer a web service without registering it in UDDI, just
as you can open a business in your basement and rely on word-of-mouth advertising but
if you want to reach a significant market, you need UDDI so your customers can find
you (http://www.asp101.com/articles/nakul/intronet/default.asp).

2.11 HTTPWebRequest and HTTPWebResponse

From MSDN, the .NET framework provides comprehensive support for the
HTTP protocol, which makes up the majority of all internet traffic, with the
HTTPWebRequest and HTTPWebResponse classes. These classes, derived from
WebRequest and WebResponse, are returned by default whenever the static method
WebRequest.Create encounters a URL beginning with http or https. In most cases, the
WebRequest and WebResponse classes provide all that is necessary to make the request,
but if the developer need access to the HTTP-specific features exposed as properties,
they can typecast these classes to HTTPWebRequest or HTTPWebResponse.

HTTPWebRequest and HTTPWebResponse encapsulate a standard HTTP


request-and-response transaction and provide access to common HTTP headers. These
classes also support most HTTP 1.1 features, including pipelining, chunking,
authentication, preauthentication, encryption, proxy support, server certificate
validation, and connection management. Custom headers and headers not provided
through properties can be stored in and accessed through the headers property.

HTTPWebRequest is the default class used by WebRequest and does not need to
be registered before you can pass a URL to the WebRequest.Create method.
26

The developer can make their application follow HTTP redirects automatically
by setting the AllowAutoRedirect property to true (the default). The application will
redirect requests, and the ResponseURL property of HTTPWebResponse will contain the
actual web resource that responded to the request. If the developer set
AllowAutoRedirect to false, their application must be able to handle redirects as HTTP
protocol errors.

Applications receive HTTP protocol errors by catching a WebException with the


status set to WebExceptionStatus.ProtocolError. The response property contains the
WebResponse sent by the server and indicates the actual HTTP error encountered.
28

CHAPTER 3

METHODOLOGY

3.0 Introduction

The approach on developing this project will be discussed in details throughout


this chapter starting from the elaboration phase, design phase, development phase and
testing and implementation phase. Figure 3.2 on the next page shows the phase of this
project.
29

Figure 3.1 Project Phases

From figure 3.1, it is very crucial to follow those steps stated above because it
will determine the success of this project. Hence, the next section will describe in details
for each phases of this project.
30

3.1 Elaboration Phase

Elaboration phase is the most important phase in this project because it will
determine the projection for the whole project. In other words, this phase acts as the
foundation for the whole project phase.

First of all, the project requirement must be defined clearly to make the job goes
swiftly as it could be. For this project, the requirement needed consist of two parts which
is the client and the server.

3.1.1 Client Side Elaboration Phase

From the client perspective, a test on download rate speed to reach intranet URL
or internet URL can be done. To make the test fully run on the client side, Windows
application has been chosen to do the task. After the task has been executed, the data
will be sent to the server webpage to store the data inside the database. The data consist
of the host’s IP address, size downloaded from the URL, duration to reach the URL,
tested URL, average speed to reach the URL and date and time of the particular test.
Figure 3.2 shows the client perspective diagram.
31

Figure 3.2 Client Perspective Diagram

3.1.2 Server Side Elaboration Phase

From the server’s perspective, a webpage which is the server will provide a
service to the service requestor. The service requestor in this project is the client
Windows application whereby it will request the server’s webpage service to store all
the data inside database and this can be done by using SOAP protocol that we had
discussed earlier in literature review part. Besides that, this webpage also will display all
the data inside the database for the monitoring purposes. Figure 3.3 shows the server
perspective diagram.
32

Figure 3.3 Server Perspective Diagram

After the project requirement has been defined clearly, now we are ready to
proceed to the next phase which is the design phase.
33

3.2 Design Phase

In design phase, all the concepts used to make this project come true will be
defined here. The design phase will be discussed for each part which is the client part
and the server part.

3.2.1 Client Side Design Phase

This section will dealing with on how to design the Windows application to meet
the specification discussed on the elaboration phase. The next section will describe in
details all the concepts used in designing the Windows application.

3.2.1.1 HTTPWebRequest and HTTPWebResponse

HTTPWebRequest and HTTPWebResponse concept will be used on the Windows


application at the client side. HTTPWebRequest will do a request based on the specified
URL defined by user and HTTPWebResponse will get a response from the particular
URL. Additional logic will be implemented to process the data obtain from the
HTTPWebResponse to calculate the average speed to reach the URL.
34

3.2.1.2 SOAP

SOAP protocol will enable the client’s Windows application to send data to the
server webpage which is the service provider.

3.2.1.3 Client Side Web Services

Web services will be used on the Windows application at the client side whereby
it will grant the Windows application to request the service provided by the server’s
webpage which is to store the data after the test has been executed into database. A
service reference has to be added within the XML configuration file on the Windows
application to use this web services technology.

3.2.2 Server Side Design Phase

This section will deal with how to design the webpage on the server side to meet
the specification discussed on the elaboration phase. The next section will describe in
details all the concepts used in designing the webpage.
35

3.2.2.1 HTML

HTML was used as the language to create the GUI for the server’s webpage
within the Microsoft Visual Studio 2008 IDE.

3.2.2.2 SQL Command

SQL command was implemented on the server’s webpage to store the data sent
by the client’s Windows application into the database and display back all the data
stored inside database through the server’s webpage.

3.2.2.3 Server Side Web Services

Web services technology has been used to provide a service to the client’s
Windows application to store the data inside database. A WebMethod has to be specified
inside the server’s webpage to provide the service to store the data sent by the client’s
Windows application inside database. Figure 3.4 shows the complete layout of
CINISTMS design.
36

Figure 3.4 CINISTMS Design Layout

3.3 Development Phase

After the design phase has been carried out, it is time to start implementing the
entire design layout for the CINISTMS. The development of CINISTMS consists of
three parts which is the CINISTMS Windows application, CINISTMS Database
webpage and database. To make things easier, the development of each part will be
discussed separately.
37

3.3.1 CINISTMS Windows Application Development

The development of the client’s Windows application was built using Microsoft
Visual Studio 2008 IDE. Figure 3.5 below shows the GUI of Microsoft Visual Studio
2008 IDE.

Figure 3.5 Microsoft Visual Studio 2008 IDE GUI

To create a new Windows application project, simply click File > New > Project
and a new project menu will appear as shown on figure 3.6.
38

Figure 3.6 New Project Menu

As seen on figure 3.6, the project types for CINISTMS are visual C# and the
templates are Windows forms application. On the name text box, write down
CINISTMS as the project name and specify the location of project within the computer
hard disk and then click the button labeled Ok to pop up a workspace for CINISTMS
Windows application as shown on figure 3.7.
39

Figure 3.7 CINISTMS Windows Application Workspace

Figure 3.7 shows CINISTMS Windows application properties whereby the


assembly name and default namespace is CINISTMS and this is the name of the project.
The target framework for CINISTMS project is .NET framework 3.5.

As seen on the right of the CINISTMS Windows application workspace, there is


a solution explorer to assist in browsing the solutions for CINISTMS Windows
application project. To create the GUI for CINISTMS Windows application double
clicks on the Form1.cs panel on the solution explorer and Form1.cs [Design] tab will
appear on the CINISTMS Windows application workspace. The GUI for CINISTMS
Windows application can be done within the Form1.cs [Design] workspace and the
source codes that run CINISTMS Windows application at the client side can be written
within the Form1.cs workspace. To view Form1.cs workspace, right clicks on Form1.cs
[Design] workspace and choose the view code option.
40

The source code written on Form1.cs workspace will enable CINISTMS


Windows application to do a test on download rate speed to reach intranet URL or
internet URL respectively. The user must write down the URL they would like to test
and CINISTMS Windows application will display the results of size downloaded from
the URL, duration to reach the URL and the average speed to reach the URL after the
button labeled Run has been clicked. The source code for CINISTMS Windows
application is attached in the appendix section and the GUI for CINISTMS Windows
application is shown on the next chapter which is the results and discussions of this
project.

After the test has been executed, tested data must be sent into the database for
monitoring purposes. To do so, a service reference must be defined inside the
CINISTMS Windows application XML configuration file to enable it to access the
service provided by the server’s webpage which is CINISTMS Database. Before adding
the service reference, CINISTMS Database website project must be included inside the
CINISTMS Windows application solution explorer. To include CINISTMS Database
website project, right click on solution CINISTMS panel and choose Add > Existing
Website to pop out add existing website menu. After the add existing website menu had
appear, choose the webpage to use as the service provider on local IIS panel and for this
project CINISTMS Database webpage has been chosen. Figure 3.8 shows the solution
explorer after CINISTMS Database website project has been included.
41

Figure 3.8 Solution Explorer with CINISTMS Database Website Project

After CINISTMS Database website project has been included, the service
reference may be added inside the CINISTMS Windows application XML configuration
file by simply right click on the reference panel on the solution explorer and choose add
service reference option to pop out add service reference menu. Click button Discover to
list down the service provided by CINISTMS Database webpage and rename the
namespace into SpeedTestServiceReference or any names that is suitable. To finish with
the add service reference setup, click button labeled Ok to add service reference inside
the CINISTMS Windows application XML configuration file. Figure 3.9 shows the add
service reference menu.
42

Figure 3.9 Add Service Reference Menu

By adding service reference inside the CINISTMS Windows application XML


configuration file, CINISTMS Windows application is able to send the data into the
database through the CINISTMS Database webpage.
43

3.3.2 CINISTMS Database Webpage Development

CINISTMS Database webpage was build within the Microsoft Visual Studio
2008 IDE as well and the web server used is IIS7 which is pre-installed in Windows
Vista. Firstly, the configuration of IIS7 through IIS manager will be discussed before
proceeding with the development of the CINISTMS Database webpage.

To open IIS manager menu, write down inetmgr on search text box inside the
start menu and the IIS manager menu will pop up. Figure 3.10 below shows the IIS
manager menu.

Figure 3.10 IIS Manager Menu


44

From figure 3.10, an explorer is located on the left of the IIS manager menu. To
create a webpage that used IIS7 as web server, click sites panel to pop up the default
website panel. At the default website panel, right click on it and choose add virtual
directory option and add virtual directory menu will popup as shown on figure 3.11
below.

Figure 3.11 Add Virtual Directory Menu

Add virtual directory menu will allow the developer to specify the physical path
of the website project and this physical path could be any place in the computer hard
disk and the alias could be any names that is suitable. For example, D://Projects will be
used as the physical path and the alias will be named as WebSite. As the result, WebSite
virtual directory has been added under the default website panel and the new website
project that used IIS7 as the web server may be easily created using the Microsoft Visual
Studio 2008 IDE.
45

After the configuration of IIS7 through IIS manager has been done, the
development of CINISTMS Database webpage may be started. To create a new website
project using the Microsoft Visual Studio 2008 IDE, simply click File > New > Website
and new website menu will pop up as shown on figure 3.12 below.

Figure 3.12 New Website Menu

From figure 3.12, WebSite alias has been used so the new website project will be
used IIS7 as the web server and shall be rename as http://localhost/WebSite/CINISTMS
Database on the location text box. Click button labeled Ok to proceed to CINISTMS
Database webpage workspace. Figure 3.13 shows the CINISTMS Database webpage
workspace.
46

Figure 3.13 CINISTMS Database Webpage Workspace

From figure 3.13, the GUI for CINISTMS Database webpage can be done by
double clicks on Default.aspx panel on the solution explorer and a space for HTML
coding will appear. This HTML space can be used to type HTML command to create the
GUI for CINISTMS Database webpage. To write a source code that runs behind the
Default.aspx, double click on the Default.aspx.cs panel and the space for coding will
appear.

The source code on the Default.aspx.cs will enable CINISTMS Database


webpage to access the database and display it through the SpeedTestLog.cs class inside
the application code panel. The connection string declaration on web.config will enable
SpeedTestLog.cs class to connect to the database. To create the SpeedTestLog.cs class,
right click on http://localhost/WebSite/CINISTMS Database/ panel and choose add new
item option. When add new item menu popup, choose a new class and rename it as
47

SpeedTestLog.cs. The source code for Default.aspx.cs and SpeedTestLog.cs class will be
attached in the appendix section and the GUI for CINISTMS Database webpage will be
shown on the next chapter which is the results and discussions of this project.

CINISTMS Database webpage depends on the CINISTMS Windows application


to obtain the data. Thus, CINISTMS Database webpage will provide a web service to
CINISTMS Windows application to store the data after the test has been executed into
the database. The data will be sent from the client to the server which is the CINISTMS
Database webpage by using SOAP protocol. To create a web service inside the
CINISTMS Database webpage, right click on http://localhost/WebSite/CINISTMS
Database/ panel and choose add new item option. When the add new item menu had
appear, choose a new web service and rename it as SpeedTestLogService.asmx and it
will automatically create the SpeedTestLogService.cs class inside the application code
panel. Inside the SpeedTestLogService.cs class, a WebMethod will be instantiated and an
object that used all the SpeedTestLog.cs class attributed will be instantiated within the
WebMethod. The source code for SpeedTestLogService.cs class will be attached in the
appendix section.

Therefore, CINISTMS Database webpage will provide a service to the service


requestor which is the CINISTMS Windows application to store the data sent into the
database.
48

3.3.3 Database Development

Database is one of the most crucial parts in CINISTMS whereby it will act as the
storage element for all the data sent by CINISTMS Windows application through the
CINISTMS Database webpage using the web services technology.

Microsoft SQL Server 2005 Express Edition may be accessible through


Microsoft SQL Server Management Studio Express whereby it will provide with the
GUI for the user to create a new database with the Microsoft SQL Server 2005 Express
Edition. Figure 3.14 below shows the GUI of Microsoft SQL Server Management Studio
Express.

Figure 3.14 Microsoft SQL Server Management Studio Express GUI


49

From figure 3.14, click the button labeled Connect to connect to the database
after write down the login password and the database interface menu will pop up and
this is where the creation of new database shall be done. Figure 3.15 below shows the
database interface menu.

Figure 3.15 Database Interface Menu

As seen on figure 3.15, a new database can be created by right click on the
database panel located at the object explorer which on the left of the database interface
menu and choose new database option. Within seconds, a new database menu will pop
up and specify the database name. As for this project, the database name will be known
as InternetSpeedTest. After the new database has been created, expand the database
panel and the system database along with InternetSpeedTest panel will be appear.
Hence, expand the InternetSpeedTest panel and a list of panel will be appear and from
that list choose the tables panel and right click on it and choose on new table option to
50

create a new table and rename it as SpeedTestLog. Figure 3.16 below shows the
SpeedTestLog table inside the InternetSpeedTest Database.

Figure 3.16 SpeedTestLog Table on InternetSpeedTest Database

SpeedTestLog table is a table whereby all the data sent from clients through the
CINISTMS Database webpage will be stored and SpeedTestLog table are located inside
the InternetSpeedTest database. As seen on figure 3.16, the table consists of seven
colums which are the Id, IpAddr, Size, Duration, TargetedUrl, AverageSpeed and
TestedDate and all the data inside the table was sent by the client. Table 3.1 on the next
page shows the table of the SpeedTestLog.
51

Table 3.1 SpeedTestLog Table

CINISTMS Database webpage will push and pull the data for SpeedTestLog
table whereby the SQL command that will do the write and read process of the data
contains inside the SpeedTestLog.cs which is located inside CINISTMS Database
website project. To make the SpeedTestLog.cs are able to do the write and read process
of the data, a connection string has been declared within the web.config of CINISTMS
Database webpage.

The read process will enable CINISTMS Database webpage to display all the
data inside SpeedTestLog table through the webpage as for the monitoring purposes
while the write process will enable CINISTMS Database webpage to push the data sent
by clients into the SpeedTestLog table which is inside the InternetSpeedTest database.

As for now, the development phase of CINISTMS has been completed and
CINISTMS are ready to proceed with the next phase of the project phases which is the
testing and implementation phase.
52

3.4 Testing and Implementation Phase

Testing and implementation phase was the final phase for this project whereby
beta testing on CINISTMS was done within this phase. The accuracy and successful of
CINISTMS can be measure here as the testing begins and any bug that occur can be
identified to fixed it. Thus, this phase is the most crucial phase and it will decide
whether what has been during the previous phases is correctly done or not.

The result for this phase will be presented on the next chapter which is the results
and discussion for this project. The next chapter will discuss about the overall
achievement of this project, problems encountered and the limitations of CINISTMS.
53

3.5 CINISTMS Data Flow

Data flow occurs during the process of executing CINISTMS. Thus, this section
will explained in details how the movement of data in CINISTMS. Figure 3.17 below
shows the CINISTMS data flow path.

Store data
Server’s
Webpage received on
server’s webpage
inside the
database.

Send processed
data on Client’s Pull the data
Windows inside database an
application to the show it through
server’s webpage. webpage.
Client’s Windows Server’s
Application Database

Client’s Windows
application do a
request on any
URL.

Client’s Windows
application
Internet
download the
Cloud
webpage content
in bytes.

Figure 3.17 CINISTMS Data Flow Path


54

3.5.1 Data Flow Between Client’s Windows Application and Internet Cloud

As seen on figure 3.17, client’s Windows application will do a request on any


URL inside the internet cloud. After the request was successfully done, client’s
Windows application will download the content of the webpage which is in bytes until
finished. The duration since the request has been made until the content of the webpage
fully downloaded was calculated by the client’s Windows application. Along with the
duration, client’s Windows application will detect the date and time of the particular test
and the host’s IP address. To calculate the average speed, client’s Windows application
simply divided the size downloaded in bytes with the duration in seconds and the
average speed is in KB/s.

The data processed inside client’s Windows application consist of the host’s IP
address, size downloaded from the URL, duration to reach the URL, tested URL,
average speed to reach the URL and date and time of the particular test. This prepared
data is ready to transport to the server’s webpage by using the web services technology.

3.5.2 Data Flow Between Client’s Windows Application and Server’s Webpage

As seen on figure 3.17, client’s Windows application will sent the prepared data
which consist of the host’s IP address, size downloaded from the URL, duration to reach
the URL, tested URL, average speed to reach the URL and date and time of the
particular test to the server’s webpage.
55

The server’s webpage is a service provider whereby it will provide a service to


store data sent by the client’s Windows application inside database and the client’s
Windows application will be known as service requestor. Thus, the data will flow from
the client’s Windows application to the server’s webpage.

3.5.3 Data Flow Between Server’s Webpage and Server’s Database.

As seen on figure 3.17, the data will flow from two directions which are from the
server’s webpage to the server’s database and vice versa. As for the direction from the
server’s webpage to the server’s database, server’s webpage will store the data received
from the client’s Windows application inside database. The data stored inside database
consist of host’s IP address, size downloaded from the URL, duration to reach the URL,
tested URL, average speed to reach the URL and date and time of the particular test.

As for monitoring purposes, server’s webpage will pull all the data inside
database and show it through the webpage and thus make it easier for the user or
network administrator to view it.
56

3.6 CINISTMS Flowcharts

Figure 3.18 CINISTMS Flowcharts


57

CHAPTER 4

RESULTS AND DISCUSSIONS

4.0 Introduction

This chapter will discuss about the achievement of CINISTMS which is the
results obtained, problem encountered with the solutions and the limitations of
CINISTMS.

4.1 CINISTMS Achievement

After going through a lot of procedure and phases of developing CINISTMS,


now it is time to evaluate how worth this project are and what is the achievement of
CINISTMS from both side which is the client and the server. As a reminder, the
objective of this project will be stated clearly before proceed with the results of this
project.
58

From the client perspective, the objective is it will do a test on the download rate
speed from both intranet and internet. Example of intranet link is www.utm.my whereby
www.google.com as an internet link example. The result obtained from the client will be
sent to the server which is a webpage as the monitoring purposes and the client will be
implemented on Microsoft Windows operating system. The data obtained from the client
are the host’s IP address, size downloaded from the URL, duration to reach the URL,
tested URL, average speed to reach the URL and date and time of the particular test.

From the server perspective, a webpage called CINISTMS Database will provide
a service whereby it will store all the data sent by clients which is the service requestor.
Besides providing those services, the webpage will display all the data inside database as
well as for the monitoring purposes.

The achievement of CINISTMS will be presented in two parts which is the client
part and the server part. CINISTMS Windows application will be the representative for
the client part while CINISTMS Database webpage will be the representative for the
server part.

4.1.1 Client Side Achievement

On the client part, CINISTMS Windows application was successfully done to


carry out the objective of this project. CINISTMS Windows application is able to do a
test on download rate speed to reach the URL that has been specified by the user itself
and it will mention the duration to reach the URL along with the size downloaded as
well. Besides that, CINISTMS Windows application is able to send the tested data which
59

are the host’s IP address, size downloaded from the URL, duration to reach the URL,
tested URL, average speed to reach the URL and date and time of the particular test to
the CINISTMS Database webpage which is the server to store the data inside database.
Figure 4.1 below shows the GUI of CINISTMS Windows application.

Figure 4.1 CINISTMS Windows Application GUI

From figure 4.1, user can easily run a test on any URL by writing down any
desired URL to test within the URL text box located right to the URL label. After that,
the user can simply click the button labeled Run to execute the test. After a while, the
host’s IP address, size downloaded from the URL, duration to reach the URL and the
average speed to reach the URL will appear.
60

After the test has been executed, CINISTMS Windows application will
automatically send the data to the server’s webpage to store it inside database since a
service reference has been declared within CINISTMS Windows application XML
configuration file to request the service provided by the server’s webpage.

The URL must be tested from both intranet link and internet link which is
www.utm.my and www.google.com respectively. The next section shows the results from
both intranet link test and internet link test.

4.1.1.1 Intranet Link Test Results

For intranet link test, www.utm.my has been chosen as the variable and figure 4.2
shows the results of intranet link test.
61

Figure 4.2 Intranet Link Test Results

As seen on figure 4.2, the results shows that the average speed to reach
www.utm.my is 158.22 KB/s and the duration to reach it is 0.14 seconds. The size
downloaded from www.utm.my is 22682 bytes and the host’s IP address is
10.60.102.145. The content field from figure 4.2 shows the HTML code of www.utm.my.
The test results which are the host’s IP address, size downloaded from www.utm.my,
duration to reach www.utm.my and the average speed to reach www.utm.my will be sent
into database through the server’s webpage by using web services technology.
62

4.1.1.2 Internet Link Test Results

For internet link test, www.google.com has been chosen as the variable and figure
4.3 below shows the results of internet link test.

Figure 4.3 Internet Link Test Results

As seen on figure 4.3, the results shows that the average speed to reach
www.google.com is 4.74 KB/s and the duration to reach it is 1.09 seconds. The size
downloaded from www.google.com is 5290 bytes and the host’s IP address is
10.60.102.145. The content field from figure 4.2 shows the HTML code of
63

www.google.com. The test results which are the host’s IP address, size downloaded from
www.google.com, duration to reach www.google.com and the average speed to reach
www.google.com will be sent into database through the server’s webpage by using web
services technology.

4.1.2 Server Side Achievement

On the server part, CINISTMS Database webpage was successfully done to carry
out the objective of this project. CINISTMS Database webpage are able to provide a
web service to the service requestor which is CINISTMS Windows application on the
client side. CINISTMS Database webpage provide a service to store all the data sent by
clients into database which are the host’s IP address, size downloaded from the URL,
duration to reach the URL, tested URL, average speed to reach the URL and date and
time of the particular test. Besides providing a web service, CINISTMS Database
webpage are able to display all the data inside database through a webpage as for
monitoring purposes. Figure 4.4 shows the GUI of CINISTMS Database webpage.
64

Figure 4.4 CINISTMS Database Webpage GUI

As seen on figure 4.4, the table contains all the data sent by clients which are the
host’s IP address, size downloaded from the URL, duration to reach the URL, tested
URL, average speed to reach the URL and date and time of the particular test. The table
on figure 4.4 is the data sent by CINISTMS Windows application on the previous
intranet link test and internet link test. The results appeared on CINISTMS Database
webpage are the same as CINISTMS Windows application results on intranet link test
and internet link test.

CINISTMS Database webpage will display all the data sent by clients according
to date. For example, figure 4.4 shows the entire test that has been executed by
CINISTMS Windows application on April 2nd 2009.
65

As for the administrator, the data sent by clients on previous day may be
accessed by Search by Date tools located on the left of CINISTMS Database webpage.
Figure 4.5 below shows the results obtained on April 15th 2009.

Figure 4.5 Results Obtained on April 15th 2009

Besides accessing the previous data sent by clients, CINISTMS Database


webpage also provide a tool to monitor specific tested URL on any date inside database.
The administrator may do so by write down any specific tested URL to monitor inside
the Search by URL text box on the left of CINISTMS Database webpage. Figure 4.6
shows the results obtained on April 15th 2009 for www.utm.my.
66

Figure 4.6 Results Obtained on April 15th 2009 for www.utm.my

On the right of CINISTMS Database webpage, there is an Internet Speed Test


tool and the concept used is much similar to CINISTMS Windows application but the
difference is the test was executed from the server side to any particular URL instead
directly from the client side as CINISTMS Windows application did.
67

4.2 Problem Encountered and Solutions

Development of CINISTMS is not an easy process whereby it has to encounter a


lot of problems and obstacle. Table 4.1 below shows the list of problems encountered
and the way to solve it.

Table 4.1 Problems Encountered and Solutions


68

4.3 Limitations of CINISTMS

CINISTMS has some limitations whereby it is not cross-platform. The terms not
cross-platform here is CINISTMS cannot run on other operating system instead
Microsoft Windows operating system which means it cannot be executed on Linux or
Mac operating system.

The second limitations of CINISTMS is the dependency on .NET framework to


run the Windows application whereby the user need to install the .NET framework first
before the Windows application can be used within the Microsoft Windows operating
system.
69

CHAPTER 5

CONCLUSIONS AND RECOMMENDATIONS

5.0 Conclusions

As for the client part, CINISTMS Windows application has successfully


achieved the objective of this project whereby it is able to do a test on download rate
speed to reach any URL from the UTM’s network. Besides that, CINISTMS Windows
application is able to send the tested data to the server’s webpage and store it inside
database for monitoring purposes.

As for the server part, CINISTMS Database webpage make the results tested by
clients easy to monitor and helpful for network administrator to do further analysis or
maintenance. CINISTMS Database webpage is able to receive the tested data sent by
clients by using web services technology and store the data inside database and display it
back for monitoring purposes.
70

5.1 Recommendations

The main disadvantage of this project is not cross-platform. Thus, a cross-


platform of CINISTMS is recommended for the next version of CINISTMS. This is
crucial as the client in UTM might use other operating system than Microsoft Windows
such as Linux and Mac operating system.

It is also recommended that the next version of CINISTMS will be independent


from .NET framework. This can be done by using others programming language than C#
such as C++ and Java. As for recommendation, Java would be the suitable programming
language to cover both weaknesses of CINISTMS which is the cross-platform and
dependency on .NET framework issue.
71

REFERENCES

1. Alex Kriegel and Boris M. Trukhnov (2008). SQL Bible. (Second Edition).
Canada: Wiley Publishing, Inc.
2. Chong Ping Chee (2004). Client Initiated Network Monitoring and Alerting
System (CINMAS) – Monitoring Server. Universiti Teknologi Malaysia:
Bachelor’s Degree Thesis.
3. Chong Tian Teck (2006). Server of Client Initiated Network Monitoring and
Alerting System (CINMAS). Universiti Teknologi Malaysia: Bachelor’s
Degree Thesis.
4. Craig Zacker (2001). Networking: The Complete Reference. California:
Osborne/McGraw – Hill.
5. Dan Heflin and Todd Ney (2000). Windows Web Scripting Developers Guide.
USA: Osborne/McGraw – Hill.
6. Dr. Shahram Khosravi (2008). Professional IIS7 and ASP.NET Integrated
Programming. Canada: Wiley Publishing, Inc.
7. Edward Whalen, Marcilina Garcia, Burzin Patel, Stacia Misner and Viktor
Isakov (2007). Microsoft SQL Server 2005. Washington: Microsoft Press.
8. H.M Deitel and P.J Deitel (2006). Visual C# 2005 How To Program. (Second
Edition). USA: Pearson Education, Inc.
9. H.M Deitel, P.J Deitel and A.B. Goldberg (2004). Internet and World Wide
Web How To Program. (Third Edition). USA: Pearson Education, Inc.
10. Loh Hong Lee (2006). Client Initiated Network Monitoring and Alerting
System (CINMAS) – Windows Agent. Universiti Teknologi Malaysia:
Bachelor’s Degree Thesis.
11. Microsoft Developer Network. MSDN (2008).
72

12. Scott Hofmann and Hethe Henrickson (2003). IIS6: The Complete Reference.
California: Osborne/McGraw – Hill.
13. Sheeraj Shah (2007). Hacking Web Services. (First Edition). Boston:
Thomson Learning, Inc.
14. Wikipedia. Internet Information Services.
http://en.wikipedia.org/wiki/Internet_Information_Services. (Accessed on
February 2009).
15. Wikipedia. Computer network.
http://en.wikipedia.org/wiki/Computer_network. (Accessed on August 2008).
16. Wikipedia. Internet Protocol Suite. http://en.wikipedia.org/wiki/ip. (Accessed
on August 2008).
17. Wikipedia. TCP/IP model. http://en.wikipedia.org/wiki/IP_model. (Accessed
on August 2008).
18. Wikipedia. List of TCP and UDP ports numbers. http://en.wikipedia.org/wiki/
List_of_TCP_and_UDP_port_numbers. (Accessed on August 2008).
19. Wikipedia. SOAP. http://en.wikipedia.org/wiki/SOAP. (Accessed on
February 2009).
20. Wikipedia. Web service. http://en.wikipedia.org/wiki/Web_services.
(Accessed on February 2009).
21. Wikipedia. XML. http://en.wikipedia.org/wiki/Xml. (Accessed on February
2009).
73

APPENDIX A

CINISTMS WINDOWS APPLICATION SOURCE CODE

This appendix will be attached with the CINISTMS Windows application


source code that runs on the client side of this project. The source code are
AssemblyInfo.cs, app.config, Form1.cs and Program.cs.
74

AssemblyInfo.cs

using System.Reflection;
using System.Runtime.CompilerServices;

using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CINISTMS")]
[assembly: AssemblyDescription("")]

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("CINISTMS")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a44f11d0-a11d-48d9-8bd3-dd1587ab3fa3")]

// Version information for an assembly consists of the following four values:


//
// Major Version
// Minor Version
// Build Number
// Revision
75

//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
76

app.config

<?xml version="1.0" encoding="utf-8" ?>


<configuration>

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SpeedTestLogServiceSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />

</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
address="http://localhost/WebSite/CINISTMS%20Database/SpeedTestLogService.a
smx"
77

binding="basicHttpBinding" bindingConfiguration="SpeedTestLogServiceSoap"
contract="SpeedTestLogServiceReference.SpeedTestLogServiceSoap"
name="SpeedTestLogServiceSoap" />
</client>
</system.serviceModel>
</configuration>
78

Form1.cs

using System;
using System.Collections.Generic;

using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Net;
using System.IO;
namespace CINISTMS
{
public partial class Form1 : Form
{

public Form1()
{
InitializeComponent();
}
private void btnGo_Click(object sender, EventArgs e)
{

DateTime requestStart = DateTime.Now;


// Get host name
String strHostName = Dns.GetHostName();
// Find host by name
IPHostEntry iphostentry = Dns.GetHostByName(strHostName);
79

// Enumerate IP addresses
String ip = "";
foreach (IPAddress ipaddress in iphostentry.AddressList)
{
ip = ipaddress.ToString();
}
txtIp.Text = (ip);

CookieContainer CookieCont = new CookieContainer();


StringBuilder sb = new StringBuilder();
String url = txtUrl.Text;
if (!url.StartsWith("http://") && !url.StartsWith("https://"))
{
url = "http://" + url;

}
HttpWebRequest request;
try
{
request = (HttpWebRequest)
HttpWebRequest.Create(url);

}
catch (Exception err)
{
txtContent.Text = ("Error: " + err);
txtSize.Text = ("");
txtDur.Text = ("");

txtAvg.Text = ("");
txtUrl.Focus();
return;
}
80

request.AllowAutoRedirect = true;
request.UserAgent = ("HTTP_USER_AGENT");
request.CookieContainer = CookieCont;
request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg" +
"application/msword, application/vnd.ms-powerpoint, application/vnd.ms-
excel, */*";
HttpWebResponse response;

try
{
response = (HttpWebResponse)
request.GetResponse();
}
catch (WebException err)

{
txtContent.Text = err.Status + " - " + err.Message;
txtSize.Text = ("");
txtDur.Text = ("");
txtAvg.Text = ("");
response = (HttpWebResponse)err.Response;

if (response == null)
{
txtUrl.Focus();
return;
}
}

catch (Exception err)


{
txtContent.Text = ("Error: " + err);
txtSize.Text = ("");
81

txtDur.Text = ("");
txtAvg.Text = ("");
txtUrl.Focus();
return;
}
// we will read data via the response stream
Stream resStream = response.GetResponseStream();

string tempString = null;


byte[] buf = new byte[256];
int count = 0;
MemoryStream ms = new MemoryStream();
do
{

// fill the buffer with data


count = resStream.Read(buf, 0, buf.Length);
// make sure we read some data
if (count != 0)
{
// translate from bytes to ASCII text

tempString = Encoding.ASCII.GetString(buf, 0, count);


ms.Write(buf, 0, count);
// continue building the string
sb.Append(tempString);
}
}

while (count > 0); // any more data to read?


long contentLength = ms.Length;
ms.Close();
resStream.Close();
82

response.Close();
TimeSpan duration = DateTime.Now - requestStart;
double sec = duration.TotalSeconds;
double avg = -1;
if (sec > 0)
{
avg = Math.Round(((double)contentLength /

(double)1024) / (double)sec, 2);


}
double roundSec = Math.Round((double)sec, 2);
txtContent.Text = (sb.ToString());
txtSize.Text = (contentLength + " Bytes");
txtDur.Text = (roundSec + " Seconds");

txtAvg.Text = (avg + " KB/s");


SpeedTestLogServiceReference.SpeedTestLogServiceSoapClient oLog =
new SpeedTestLogServiceReference.SpeedTestLogServiceSoapClient();
oLog.InsertSpeedTestLog(ip, contentLength, roundSec, url, avg, DateTime.Now);
}
}

}
83

Program.cs

using System;
using System.Collections.Generic;

using System.Windows.Forms;
namespace CINISTMS
{
static class Program
{
/// <summary>

/// The main entry point for the application.


/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
84

APPENDIX B

CINISTMS DATABASE WEBPAGE SOURCE CODE

This appendix will be attached with the CINISTMS Database Webpage


source code that runs on the server side of this project. The source code are
SpeedTestLog.cs, SpeedTestLogService.cs and Default.aspx.cs.
85

SpeedTestLog.cs

using System;
using System.Data;

using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;
/// <summary>

/// Summary description for SpeedTestLog


/// </summary>
public class SpeedTestLog
{
static string _connectionString =
ConfigurationManager.ConnectionStrings["SpeedTestConnectionString"].Connectio
nString;
int _id;

string _ipAddr;
long _contentLength;
double _sec;
string _targetedUrl;
double _averageSpeed;
86

DateTime _testedDate;
public int Id
{
get
{
return _id;
}

set
{
_id = value;
}
}
public string IpAddr

{
get
{
return _ipAddr;
}
set

{
_ipAddr = value;
}
}
public long ContentLength
{

get
{
return _contentLength;
}
87

set
{
_contentLength = value;
}
}
public double Sec
{

get
{
return _sec;
}
set
{

_sec = value;
}
}
public string TargetedUrl
{
get

{
return _targetedUrl;
}
set
{
_targetedUrl = value;

}
}
public double AverageSpeed
{
88

get
{
return _averageSpeed;
}
set
{
_averageSpeed = value;

}
}
public DateTime TestedDate
{
get
{

return _testedDate;
}
set
{
_testedDate = value;
}

}
public SpeedTestLog()
{
}
public SpeedTestLog(int id, string ipAddr, long contentLength, double sec, string
targetedUrl, double averageSpeed, DateTime testedDate)
{
_id = id;
_ipAddr = ipAddr;
_contentLength = contentLength;
89

_sec = sec;
_targetedUrl = targetedUrl;
_averageSpeed = averageSpeed;
_testedDate = testedDate;
}
public void WriteToLog()
{

SqlParameter hostIp = new SqlParameter("@hostIp",


System.Data.SqlDbType.NChar);
hostIp.Value = IpAddr;
SqlParameter size = new SqlParameter("@size", System.Data.SqlDbType.NChar);

size.Value = ContentLength;

SqlParameter duration = new SqlParameter("@duration",


System.Data.SqlDbType.NChar);

duration.Value = Sec;
SqlParameter tgtUrl = new SqlParameter("@tgtUrl",
System.Data.SqlDbType.NChar);
tgtUrl.Value = TargetedUrl;

SqlParameter avg = new SqlParameter("@avg", System.Data.SqlDbType.Float);


avg.Value = AverageSpeed;
SqlParameter tstDate = new SqlParameter("@tstDate",
System.Data.SqlDbType.DateTime);

tstDate.Value = TestedDate;
string commandString = "INSERT INTO dbo.SpeedTestLog (IpAddr, Size,
Duration, TargetedUrl, AverageSpeed, TestedDate)" +
"VALUES (@hostIp, @size, @duration, @tgtUrl, @avg, @tstDate)";

using (SqlConnection connection = new SqlConnection(_connectionString))


{
SqlCommand command = new SqlCommand(commandString, connection);
command.Parameters.Add(hostIp);
90

command.Parameters.Add(size);
command.Parameters.Add(duration);
command.Parameters.Add(tgtUrl);
command.Parameters.Add(avg);
command.Parameters.Add(tstDate);
connection.Open();
command.ExecuteNonQuery();

}
}
public static List<SpeedTestLog> ReadFromLog(string targetedUrl, DateTime
testedDate)

{
List<SpeedTestLog> result = new List<SpeedTestLog>();
string strQuery = String.Empty;
if (targetedUrl != String.Empty && testedDate == DateTime.MinValue)
{
strQuery = "Select * from SpeedTestLog Where TargetedUrl = @TargetedUrl";

}
else if (targetedUrl == String.Empty && testedDate != DateTime.MinValue)
{
strQuery = "Select * from SpeedTestLog Where DateDiff(day, TestedDate,
@TestedDate) = 0";
}
else if (targetedUrl != String.Empty && testedDate != DateTime.MinValue)
{
strQuery = "Select * from SpeedTestLog Where TargetedUrl = @TargetedUrl And
DateDiff(day, TestedDate, @TestedDate) = 0";
}
using (SqlConnection connection = new SqlConnection(_connectionString))
{
91

SqlCommand command = new SqlCommand(strQuery, connection);


if (targetedUrl != String.Empty) command.Parameters.Add(new
SqlParameter("@TargetedUrl", targetedUrl));
if (testedDate != DateTime.MinValue) command.Parameters.Add(new
SqlParameter("@TestedDate", testedDate));
connection.Open();
SqlDataReader reader = command.ExecuteReader();
if (reader.HasRows)
{

while (reader.Read())
{
SpeedTestLog objLog = new SpeedTestLog();
objLog.Id = Convert.ToInt32(reader["Id"]);
if (reader["IpAddr"] != DBNull.Value)
{

objLog.IpAddr = reader["IpAddr"].ToString();
}
if (reader["Size"] != DBNull.Value)
{
objLog.ContentLength = Convert.ToInt64(reader["Size"]);
}

if (reader["Duration"] != DBNull.Value)
{
objLog.Sec = Convert.ToDouble(reader["Duration"]);
}
if (reader["TargetedUrl"] != DBNull.Value)
{

objLog.TargetedUrl = reader["TargetedUrl"].ToString();
}
if (reader["AverageSpeed"] != DBNull.Value)
92

{
objLog.AverageSpeed = Convert.ToDouble(reader["AverageSpeed"]);
}
if (reader["TestedDate"] != DBNull.Value)
{
objLog.TestedDate = Convert.ToDateTime(reader["TestedDate"]);
}

result.Add(objLog);
}
}
}
return result;
}

}
93

SpeedTestLogService.cs

using System;
using System.Collections;

using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

/// <summary>
/// Summary description for SpeedTestLogService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX,
uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class SpeedTestLogService : System.Web.Services.WebService
{

public SpeedTestLogService()
{

//Uncomment the following line if using designed components


//InitializeComponent();

[WebMethod]
94

public void InsertSpeedTestLog(string ipAddr, long contentLength, double sec,


string targetedUrl, double averageSpeed, DateTime testedDate)
{
SpeedTestLog objLog = new SpeedTestLog();
objLog.IpAddr = ipAddr;

objLog.ContentLength = contentLength;
objLog.Sec = sec;
objLog.TargetedUrl = targetedUrl;
objLog.AverageSpeed = averageSpeed;
objLog.TestedDate = testedDate;
objLog.WriteToLog();

}
}
95

Default.aspx.cs

using System;
using System.Collections;

using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;

using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.IO;

using System.Net;
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)

{
calTestedDate.SelectedDate = DateTime.Today;
List<SpeedTestLog> collection = SpeedTestLog.ReadFromLog(txtTgtUrl.Text,
calTestedDate.SelectedDate);

dgTestLog.DataSource = collection;
dgTestLog.DataBind();
}
96

}
protected void btnSearch_Click(object sender, EventArgs e)
{
string url = txtTgtUrl.Text;
if (url != String.Empty && !url.StartsWith("http://") && !url.StartsWith("https://"))
{
url = "http://" + url;

}
List<SpeedTestLog> collection = SpeedTestLog.ReadFromLog(url,
calTestedDate.SelectedDate);
dgTestLog.DataSource = collection;

dgTestLog.DataBind();
}
protected void btnGo_Click(object sender, EventArgs e)
{
DateTime requestStart = DateTime.Now;
CookieContainer cookieCont = new CookieContainer();

String url = txtUrl.Text;


if (!url.StartsWith("http://") && !url.StartsWith("https://"))
{
url = "http://" + url;
}
HttpWebRequest request;

try
{
request = (HttpWebRequest)
HttpWebRequest.Create(url);
}
catch (Exception err)
97

{
txtUrl.Text = ("Error: " + err);
txtUrl.Focus();
txtSize.Text = ("");
txtDur.Text = ("");
txtAvg.Text = ("");
return;

}
request.AllowAutoRedirect = true;
request.UserAgent = ("HTTP_USER_AGENT");
request.CookieContainer = cookieCont;
request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*";
HttpWebResponse response;
try
{
response = (HttpWebResponse)

request.GetResponse();
}
catch (WebException err)
{
txtUrl.Text = err.Status + " - " + err.Message;
txtSize.Text = ("");

txtDur.Text = ("");
txtAvg.Text = ("");
response = (HttpWebResponse)err.Response;
if (response == null)
{
txtUrl.Focus();
98

return;
}
}
catch (Exception err)
{
txtUrl.Text = ("Error: " + err);
txtSize.Text = ("");

txtDur.Text = ("");
txtAvg.Text = ("");
txtUrl.Focus();
return;
}
// we will read data via the response stream

Stream resStream = response.GetResponseStream();


byte[] buf = new byte[256];
int count = 0;
MemoryStream ms = new MemoryStream();
do
{

// fill the buffer with data


count = resStream.Read(buf, 0, buf.Length);
ms.Write(buf, 0, count);
}
while (count > 0); // any more data to read?
long contentLength = ms.Length;

ms.Close();
resStream.Close();
response.Close();
TimeSpan duration = DateTime.Now - requestStart;
99

double sec = duration.TotalSeconds;


double avg = -1;
if (sec > 0)
{
avg = Math.Round(((double)contentLength / (double)1024) / (double)sec, 2);
}
double roundSec = Math.Round((double)sec, 2);

txtSize.Text = (contentLength + " Bytes");


txtDur.Text = (roundSec + " Seconds");
txtAvg.Text = (avg + " KB/s");
}
}
100

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"


Inherits="Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>CINISTMS Database</title>
</head>
<body>
<form id="form1" runat="server">

<table width="100%">
<tr>
<td width="20%" align="center" valign="top">
&nbsp;</td>
<td width="60%" align="center">
<img src="utm_header_new.jpg" /><br />

<br />
<br />
</td>
<td width="20%" align="center" valign="top">
&nbsp;</td>
</tr>

<tr>
<td width="20%" align="center" bgcolor="#F87D20"
style="border-style: solid; border-color: #FFFFFF" valign="top">
<asp:Label ID="lblHeaderAdmin" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="Black"
101

Text="ADMINISTRATIVE TOOLS"></asp:Label>
</td>
<td width="60%" align="center" bgcolor="#F87D20"
style="border-style: solid; border-color: #FFFFFF" valign="top">
<asp:Label ID="lblHeaderDatabase" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="Black"
Text="CINISTMS DATABASE"></asp:Label>

</td>
<td width="20%" align="center" bgcolor="#F87D20"
style="border-style: solid; border-color: #FFFFFF" valign="top">
<asp:Label ID="lblHeaderInternet" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="Black"
Text="INTERNET SPEED TEST"></asp:Label>

</td>
</tr>
<tr>
<td width="20%" align="center"
style="border-style: solid; border-color: #FFFFFF; background-color: #5D7B9D"
valign="top">

<br />
<asp:Label ID="lblTgtUrl" runat="server" Font-Bold="True" Font-
Names="Verdana"
Font-Size="Small" ForeColor="White" Text="Search by URL:"></asp:Label>

<br />
<br />
<asp:TextBox ID="txtTgtUrl" runat="server" Width="200px" Font-
Names="Verdana"

Font-Size="Small"></asp:TextBox>
<br />
<br />
102

<asp:Label ID="lblTestedDate" runat="server" Font-Bold="True"


Font-Names="Verdana" Font-Size="Small" ForeColor="White"
Text="Search by date:"></asp:Label>
<br />
<br />
<asp:Calendar ID="calTestedDate" runat="server" BackColor="White"
BorderColor="#999999" CellPadding="4" DayNameFormat="Shortest"

Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" Height="180px"


Width="200px">
<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
<SelectorStyle BackColor="#CCCCCC" />
<WeekendDayStyle BackColor="#FFFFCC" />
<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />

<OtherMonthDayStyle ForeColor="#808080" />


<NextPrevStyle VerticalAlign="Bottom" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
</asp:Calendar>
<br />

<asp:Button ID="btnSearch" runat="server" onclick="btnSearch_Click"


Text="Search" Font-Bold="True" Font-Names="Verdana" Font-Size="Small"
BackColor="White" />
<br />
<br />
</td>

<td width="60%" valign="top" bgcolor="White"


style="border-style: solid; border-color: #FFFFFF">
<asp:GridView ID="dgTestLog" runat="server" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%"
103

Font-Names="Verdana" Font-Size="Small">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>

<asp:BoundField DataField="IpAddr" HeaderText="IP Address" >


<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="TargetedUrl" HeaderText="Targeted Url" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>

<asp:BoundField DataField="AverageSpeed" HeaderText="Average Speed KB/s" >


<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="TestedDate" HeaderText="Tested Date" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>

</Columns>
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"
/>
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True"
ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" Font-Names="Verdana"
Font-Size="Small" ForeColor="White" />
<EditRowStyle BackColor="#999999" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />


</asp:GridView>
</td>
104

<td width="20%"
style="background-color: #5D7B9D; border-style: solid; border-color: #FFFFFF"
align="center" valign="top">
<br />
<asp:Label ID="lblUrl" runat="server" Font-Bold="True" Font-Names="Verdana"
Font-Size="Small" ForeColor="White" Text="URL to test:"></asp:Label>
<br />

<br />
<asp:TextBox ID="txtUrl" runat="server" Width="200px" Font-Names="Verdana"
Font-Size="Small"></asp:TextBox>
<br />
<br />
<asp:Label ID="lblInstruction" runat="server" Font-Bold="False"

Font-Names="Verdana" Font-Size="Small" ForeColor="White"


Text="Instruction: Fill any URL on the text box and click button Run Test to
test."></asp:Label>
<br />

<br />
<asp:Button ID="btnGo" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" Text="Run Test"
onclick="btnGo_Click" BackColor="White" />
<br />
<br />

<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Names="Verdana"


Font-Size="Small" ForeColor="White" Text="Result:"></asp:Label>
<br />
<br />
<asp:Label ID="lblSize" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="White"
105

Text="Size downloaded:"></asp:Label>
<br />
<br />
<asp:TextBox ID="txtSize" runat="server" Font-Names="Verdana" Font-
Size="Small"></asp:TextBox>

<br />
<br />
<asp:Label ID="lblDuration" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" ForeColor="White"
Text="Duration:"></asp:Label>
<br />
<br />
<asp:TextBox ID="txtDur" runat="server" Font-Names="Verdana" Font-
Size="Small"></asp:TextBox>
<br />
<br />
<asp:Label ID="lblAvg" runat="server" Font-Bold="True" Font-Names="Verdana"
Font-Size="Small" ForeColor="White" Text="Average speed:"></asp:Label>
<br />
<br />
<asp:TextBox ID="txtAvg" runat="server" Font-Names="Verdana" Font-
Size="Small"></asp:TextBox>
<br />

<br />
</td>
</tr>
<tr>
<td width="20%" align="center" valign="top">
</td>

<td width="60%" align="center" bgcolor="White" valign="top">


106

<asp:Label ID="lblCredit" runat="server" Font-Bold="False" Font-


Names="Verdana"
Font-Size="X-Small"
Text="CINISTMS | CINISTMS Database | Developed by Ahmad Nazmi Bin Ahmad
Najib Kamil | Supervised by Assoc. Prof. Dr. Sulaiman Bin Mohd.
Nor"></asp:Label>
</td>

<td width="20%" align="center" valign="top">


</td>
</tr>
<tr>
<td width="20%" align="center" valign="top">
</td>

<td width="60%" align="center" bgcolor="#F87D20" valign="top">


<asp:Label ID="lblCopyright" runat="server" Font-Bold="True"
Font-Names="Verdana" Font-Size="X-Small"
Text="Copyright 2009 @ Ahmad Nazmi Bin Ahmad Najib Kamil"></asp:Label>
</td>
<td width="20%" align="center" valign="top">

</td>
</tr>
</table>
</form>
</body>
</html>
107

web.config

<?xml version="1.0"?>
<!--

Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config

-->
<configuration>
<configSections>
<sectionGroup name="system.web.extensions"
type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting"
type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler"
type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices"
type="System.Web.Configuration.ScriptingWebServicesSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization"
type="System.Web.Configuration.ScriptingJsonSerializationSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="Everywhere" />
108

<section name="profileService"
type="System.Web.Configuration.ScriptingProfileServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />

<section name="authenticationService"
type="System.Web.Configuration.ScriptingAuthenticationServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />
<section name="roleService"
type="System.Web.Configuration.ScriptingRoleServiceSection,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" requirePermission="false"
allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

<appSettings/>
<connectionStrings>
<add name="SpeedTestConnectionString" connectionString="Data
Source=AHMADNAZMI-PC\SQLEXPRESS;Initial
Catalog=InternetSpeedTest;User ID=SpeedTestUser;pwd=123456"
providerName="System.Data.SqlClient" />

</connectionStrings>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only

during development.
-->
<compilation debug="false">
109

<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral,


PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>

<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />

<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">


<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
110

<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls"
assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>

<remove verb="*" path="*.asmx"/>


<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>

<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
111

<providerOption name="WarnAsError" value="false"/>


</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
warningLevel="4"
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>

</compiler>
</compilers>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under
Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler"
type="System.Web.Handlers.ScriptModule, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>

<remove name="ScriptHandlerFactory" />


<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
112

<add name="ScriptHandlerFactory" verb="*" path="*.asmx"


preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*"
path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"
path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>

<assemblyIdentity name="System.Web.Extensions"
publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>

<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design"
publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Potrebbero piacerti anche