You are on page 1of 82

TABLE OF CONTENTS

CHAPTER NO TITLE PAGE NO

ABSTRACT iii
LIST OF TABLES viii
LIST OF FIGURES x
LIST OF ABBREVIATIONS xii

1. INTRODUCTION 1
1.1 PROJECT DESCRIPTION

2. SYSTEM STUDY 11
2.1 FEASABILITY STUDY
2.2 EXISTING SYSTEM
2.3 PROPOSED SYSTEM
3 SYSTEM SPECIFICATION 14
3.1 SOFTWARE REQUIREMENTS
3.2 HARDWARE REQUIREMENTS
4 LANGUAGE SPECIFICATION 15
4.1 FEATURES OF VB .NET
4.2 FEATURES OF SQL SERVER 2000

5 SYSTEM DESIGN 32
5.1 INPUT DESIGN
5.2 OUTPUT DESIGN
5.3 DATABASE DESIGN
5.4 DATA FLOW DIAGRAM
5.5 SYSTEM FLOW DIAGRAM

6 SYSTEM TESTING AND MAINTENANCE 58


6.1 UNIT TESTING
6.2 INTEGRATION TESTING
6.3 VALIDATION
7 SYSTEM IMPLEMENTATION 59
7.1 SCOPE FOR FUTURE DEVELOPMENT
8 CONCLUSION 60
9 BIBLIOGRAPHY 62
APPENDIX
• SCREEN SHOT
• DATA TABLE STRUCTURE
• SAMPLE CODING
I.
LIST OF FIGURES

FIGURE NO NAME PAGE


NO

1 .NET FRAMEWORK 10

2 INTEROPERABILITY 12
ACTIVE MONITORING AND ALARM MANAGEMENT
FOR FAULT LOCALIZATION IN TRANSPARENT ALL-
OPTICAL NETWORKS

ABSTRACT:

This application is addresses the localization accuracy in large network topologies


while maintaining low complexity, we also expand this problem into a hierarchically-
distributed monitoring model. It will formulate activation problem for optimal monitor
using Integer Linear Program (ILP). General simulation results provide supporting
analysis and comparisons of achievable alarm-vector reduction, localization coverage,
and time complexity, for flat and hierarchically distributed monitoring approaches. It will
improve the effectiveness of the application using proposed technique in efficient and
scalable monitoring of transparent optical networks. It provides extensive numerical
results and performance comparisons for the centralized and hierarchically distributed
monitoring in common and random network topologies. A centralized monitoring model
consists of a single central fault-manager which receives alarms from all monitors in the
network and processes them as a fault-vector to localize a fault.
INTRODUCTION

EMERGING transparent optical networks (TONs) introduce many advantages,


including the ability to efficiently leverage large bandwidth potential and provide
transparent support for diverse transmission protocols. However, optical transparency
also introduces a requirement for a new monitoringand fault-localization approach at the
optical layer. Dueto the lack of optical/electro/optical (O/E/O) regeneration in TONs, a
single fault may propagate throughout the network, thus generating a flood of redundant
alarms, increasing the processing overhead and localization time, and ultimately delaying
service restoration. With inherently high data rates, Frequent disruptions in TONs
include: bending or cutting of fiber, equipment failure, human error, and sophisticated
attacks Ideally, physical failures should be detected, localized, and resolved at the optical
layer before they are noticed and handled by the higher layer protocols. Legacy
monitoring techniques in SONET/SDH provide 50ms optical layer restoration, but cannot
be directly applied in TONs due to required O/E/O conversion at each node. Most of the
recently proposed TON monitoring techniques are based on different schemes for
establishment of dedicated supervisory cycles or paths which are provisioned on
dedicated wavelengths through the monitored network elements . However, these
schemes introduce additional overhead in terms of the required bandwidth, dedicated
transponders and monitors, supervisory-path computation and provisioning time, added
channel interference, and necessary maintenance. Furthermore, only monitoring of the
edge failures is commonly considered, and the proposed techniques may become
inefficient for detailed localization of individual fiber-spans and discrete optical
components in large topologies.
1.1 PROJECT DESCRIPTION
Modules:
In this system, we are localizing the fault while the nodes are running in the network .To
achieve this, we are creating following modules:
 Authentication

 Node Verification and Error Localization

 Node Distribution

 Distributed System

Authentication:
This module provides priority how the user goes to use our application. When a user will
login into the application, it has to verify the user’s privileges. When the user has a
privilege of client, he cannot check the fault nodes from the network but He can make the
communication to anyone in our distributed system.
Node Verification and Error Localization:
The Fault localization is a needed one when we are using the distributed system. To
achieve it, we are verify the valid nodes from the network and localize the fault and
provide the instruction to resolve the problems .The valid node only distributed to our
clients when they are still working.
Valid Node Distribution:
In this module, after checking the valid nodes from the network, we are distributing those
nodes to make the communication among the clients. This approach should be a good one
to avoid the data losing and provides the QoS.
Distributed System:
This module gives the interaction system among the clients and when we want to localize
the fault whiles the interaction. It should be a better system to indicate the fault of the
system and perfect reasons to the server.

2. SYSTEM STUDY

2.1 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and business proposal is put
forth with a very general plan for the project and some cost estimates. During system
analysis the feasibility study of the proposed system is to be carried out. This is to ensure
that the proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.
Three key considerations involved in the feasibility analysis are

♦ ECONOMICAL FEASIBILITY
♦ TECHNICAL FEASIBILITY
♦ SOCIAL FEASIBILITY

ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the system will
have on the organization. The amount of fund that the company can pour into the
research and development of the system is limited. The expenditures must be justified.
Thus the developed system as well within the budget and this was achieved because most
of the technologies used are freely available. Only the customized products had to be
purchased.
TECHNICAL FEASIBILITY
This study is carried out to check the technical feasibility, that is, the
technical requirements of the system. Any system developed must not have a high
demand on the available technical resources. This will lead to high demands on the
available technical resources. This will lead to high demands being placed on the client.
The developed system must have a modest requirement, as only minimal or null changes
are required for implementing this system.

SOCIAL FEASIBILITY

The aspect of study is to check the level of acceptance of the system by the user.
This includes the process of training the user to use the system efficiently. The user must
not feel threatened by the system, instead must accept it as a necessity. The level of
acceptance by the users solely depends on the methods that are employed to educate the
user about the system and to make him familiar with it. His level of confidence must be
raised so that he is also able to make some constructive criticism, which is welcomed, as
he is the final user of the system.

2.2 EXISTING SYSTEM


Existing system works on objects shared by Byzantine processes
consider that the access to operations in these objects is protected by ACLs. In this
model, each operation provided by an object is associated to a list of processes that have
access to that operation. Only processes that have access to an operation can execute it.
This model requires a kind of reference monitor to protect the objects from unauthorized
access. The implementation of this monitor is not problematic

2.3 PROPOSED SYSTEM


The proposal for distributed computing with shared memory accessed by
Byzantine processes presented in this paper differs from the previous model where
objects are protected by ACLs. Our approach is based on the use of fine-grained access
policies that specify rules that allow or deny an operation invocation to be executed in an
object based on the arguments of the operation, its invoker, and the state of the object.
The constructions presented in this paper (consensus and universal objects) demonstrate
that this approach allows the development of simple and elegant algorithms, at the cost of
defining access policies for the shared memory objects they use.

3. SYSTEM SPECIFICATION

SOFTWARE REQUIREMENTS:
• Operating system :- Windows 07& XP
• Front End :- Visual Studio 2008, C#.Net,
• Backend :- SQL Server 2005

HARDWARE REQUIREMENTS:

• SYSTEM : Pentium Duel Core


• HARD DISK : 160 GB
• RAM : 2 GB

4. LANGAUGE SPECIFICATION

4.1 FEATURES OF. NET


Microsoft .NET is a set of Microsoft software technologies for rapidly
building and integrating XML Web services, Microsoft Windows-based applications, and
Web solutions. The .NET Framework is a language-neutral platform for writing programs
that can easily and securely interoperate. There’s no language barrier with .NET: there
are numerous languages available to the developer including Managed C++, C#, Visual
Basic and Java Script. The .NET framework provides the foundation for components to
interact seamlessly, whether locally or remotely on different platforms. It standardizes
common data types and communications protocols so that components created in
different languages can easily interoperate.

“.NET” is also the collective name given to various software components


built upon the .NET platform. These will be both products (Visual Studio.NET and
Windows.NET Server, for instance) and services (like Passport, .NET My Services, and
so on).

THE .NET FRAMEWORK


The .NET Framework has two main parts:
1. The Common Language Runtime (CLR).
2. A hierarchical set of class libraries.

The CLR is described as the “execution engine” of .NET. It provides the environment
within which programs run. The most important features are

♦ Conversion from a low-level assembler-style language, called


Intermediate Language (IL), into code native to the platform being
executed on.
♦ Memory management, notably including garbage collection.
♦ Checking and enforcing security restrictions on the running code.
♦ Loading and executing programs, with version control and other such
features.
♦ The following features of the .NET framework are also worth description:
MANAGED CODE
The code that targets .NET, and which contains certain extra
Information - “metadata” - to describe itself. Whilst both managed and unmanaged code
can run in the runtime, only managed code contains the information that allows the CLR
to guarantee, for instance, safe execution and interoperability.

MANAGED DATA
With Managed Code comes Managed Data. CLR provides memory
allocation and Deal location facilities, and garbage collection. Some .NET languages use
Managed Data by default, such as C#, Visual Basic.NET and JScript.NET, whereas
others, namely C++, do not. Targeting CLR can, depending on the language you’re using,
impose certain constraints on the features available. As with managed and unmanaged
code, one can have both managed and unmanaged data in .NET applications - data that
doesn’t get garbage collected but instead is looked after by unmanaged code.
COMMON TYPE SYSTEM
The CLR uses something called the Common Type System (CTS) to strictly
enforce type-safety. This ensures that all classes are compatible with each other, by
describing types in a common way. CTS define how types work within the runtime,
which enables types in one language to interoperate with types in another language,
including cross-language exception handling. As well as ensuring that types are only used
in appropriate ways, the runtime also ensures that code doesn’t attempt to access memory
that hasn’t been allocated to it.

COMMON LANGUAGE SPECIFICATION


The CLR provides built-in support for language interoperability. To ensure that
you can develop managed code that can be fully used by developers using any
programming language, a set of language features and rules for using them called the
Common Language Specification (CLS) has been defined. Components that follow these
rules and expose only CLS features are considered CLS-compliant.

THE CLASS LIBRARY


.NET provides a single-rooted hierarchy of classes, containing over 7000
types. The root of the namespace is called System; this contains basic types like Byte,
Double, Boolean, and String, as well as Object. All objects derive from System. Object.
As well as objects, there are value types. Value types can be allocated on the stack, which
can provide useful flexibility. There are also efficient means of converting value types to
object types if and when necessary.

The set of classes is pretty comprehensive, providing collections, file,


screen, and network I/O, threading, and so on, as well as XML and database connectivity.
The class library is subdivided into a number of sets (or namespaces), each
providing distinct areas of functionality, with dependencies between the namespaces kept
to a minimum.

LANGUAGES SUPPORTED BY .NET

The multi-language capability of the .NET Framework and Visual


Studio .NET enables developers to use their existing programming skills to build all types
of applications and XML Web services. The .NET framework supports new versions of
Microsoft’s old favorites Visual Basic and C++ (as VB.NET and Managed C++), but
there are also a number of new additions to the family.
Visual Basic .NET has been updated to include many new and improved
language features that make it a powerful object-oriented programming language. These
features include inheritance, interfaces, and overloading, among others. Visual Basic also
now supports structured exception handling, custom attributes and also supports multi-
threading.
Visual Basic .NET is also CLS compliant, which means that any CLS-
compliant language can use the classes, objects, and components you create in Visual
Basic .NET.
Managed Extensions for C++ and attributed programming are just some of
the enhancements made to the C++ language. Managed Extensions simplify the task of
migrating existing C++ applications to the new .NET Framework.
C# is Microsoft’s new language. It’s a C-style language that is essentially
“C++ for Rapid Application Development”. Unlike other languages, its specification is
just the grammar of the language. It has no standard library of its own, and instead has
been designed with the intention of using the .NET libraries as its own.
Microsoft Visual J# .NET provides the easiest transition for Java-language
developers into the world of XML Web Services and dramatically improves the
interoperability of Java-language programs with existing software written in a variety of
other programming languages.
Active State has created Visual Perl and Visual Python, which enable
.NET-aware applications to be built in either Perl or Python. Both products can be
integrated into the Visual Studio .NET environment. Visual Perl includes support for
Active State’s Perl Dev Kit.

Other languages for which .NET compilers are available include


• FORTRAN
• COBOL
• Eiffel
Fig1 .Net Framework
ASP.NET Windows Forms
XML WEB SERVICES
Base Class Libraries
Common Language Runtime
Operating System

4.2 FEATURES OF C#. NET

C#.NET is also compliant with CLS (Common Language Specification) and


supports structured exception handling. CLS is set of rules and constructs that are
supported by the CLR (Common Language Runtime). CLR is the runtime environment
provided by the .NET Framework; it manages the execution of the code and also makes
the development process easier by providing services.
C#.NET is a CLS-compliant language. Any objects, classes, or components that
created in C#.NET can be used in any other CLS-compliant language. In addition, we can
use objects, classes, and components created in other CLS-compliant languages in
C#.NET. The use of CLS ensures complete interoperability among applications,
regardless of the languages used to create the application.

CONSTRUCTORS AND DESTRUCTORS:

Constructors are used to initialize objects, whereas destructors are used to


destroy them. In other words, destructors are used to release the resources allocated to the
object. In C#.NET the sub finalize procedure is available. The sub finalize procedure is
used to complete the tasks that must be performed when an object is destroyed. The sub
finalize procedure is called automatically when an object is destroyed. In addition, the
sub finalize procedure can be called only from the class it belongs to or from derived
classes.

GARBAGE COLLECTION

Garbage Collection is another new feature in C#.NET. The .NET Framework


monitors allocated resources, such as objects and variables. In addition, the .NET
Framework automatically releases memory for reuse by destroying objects that are no
longer in use.

In C#.NET, the garbage collector checks for the objects that are not currently in
use by applications. When the garbage collector comes across an object that is marked for
garbage collection, it releases the memory occupied by the object.

OVERLOADING

Overloading is another feature in C#. Overloading enables us to define multiple


procedures with the same name, where each procedure has a different set of arguments.
Besides using overloading for procedures, we can use it for constructors and properties in
a class.

MULTITHREADING:
C#.NET also supports multithreading. An application that supports multithreading
can handle multiple tasks simultaneously, we can use multithreading to decrease the time
taken by an application to respond to user interaction.

STRUCTURED EXCEPTION HANDLING

C#.NET supports structured handling, which enables us to detect and remove


errors at runtime. In C#.NET, we need to use Try…Catch…Finally statements to create
exception handlers. Using Try…Catch…Finally statements, we can create robust and
effective exception handlers to improve the performance of our application.

THE .NET FRAMEWORK

The .NET Framework is a new computing platform that simplifies application


development in the highly distributed environment of the Internet.

OBJECTIVES OF .NET FRAMEWORK

1. To provide a consistent object-oriented programming environment whether object


codes is stored and executed locally on Internet-distributed, or executed remotely.

2. To provide a code-execution environment to minimizes software deployment and


guarantees safe execution of code.

3. Eliminates the performance problems.

There are different types of application, such as Windows-based applications and


Web-based applications.

FEATURES OF SQL-SERVER

The OLAP Services feature available in SQL Server version 7.0 is now called
SQL Server 2000 Analysis Services. The term OLAP Services has been replaced with the
term Analysis Services. Analysis Services also includes a new data mining component.
The Repository component available in SQL Server version 7.0 is now called Microsoft
SQL Server 2000 Meta Data Services. References to the component now use the term
Meta Data Services. The term repository is used only in reference to the repository
engine within Meta Data Services
SQL-SERVER database consist of six type of objects,
They are,
1. TABLE
2. QUERY
3. FORM
4. REPORT
5. MACRO

TABLE:
A database is a collection of data about a specific topic.

VIEWS OF TABLE:

We can work with a table in two types,

1. Design View
2. Datasheet View

DESIGN VIEW

To build or modify the structure of a table we work in the table design view. We
can specify what kind of data will be hold.

DATASHEET VIEW

To add, edit or analyses the data itself we work in tables datasheet view mode.

QUERY:
A query is a question that has to be asked the data. Access gathers data that
answers the question from one or more table. The data that make up the answer is either
dynaset (if you edit it) or a snapshot (it cannot be edited).Each time we run query, we get
latest information in the dynaset. Access either displays the dynaset or snapshot for us to
view or perform an action on it, such as deleting or updating.

5. SYSTEM DESIGN
Design is concerned with identifying software components specifying
relationships among components. Specifying software structure and providing blue print
for the document phase. Modularity is one of the desirable properties of large systems. It
implies that the system is divided into several parts. In such a manner, the interaction
between parts is minimal clearly specified. Design will explain software components in
detail. This will help the implementation of the system. Moreover, this will guide the
further changes in the system to satisfy the future requirements.

Database Diagram:

Registration for Collecting Fault


Localization
Authentication Details
Database

Valid Nodes
Checking

Verify the user at Distributing Valid Collecting all fault


LOGIN Page Nodes details to be report
Table Structure:
Authentication Table:

Valid Nodes Table:


Fault Details Table:

System Design:
Use case Diagram:

Class Diagram:
V a li d N o d e d i s t r i b Du tiiso tnr i b u t e d S y s t e m
A u t h e n t ic a tio n
N o d e V e r if i c a t i o n N ode N am e Node N am e
U ser N am e
Node nam e S e r ve r N a m e IP _ A d d r e s s
P a s s w o rd
F a u lt D e t a il s m essage
S e c u r i t y Q u e s t io n
C o ll e c t in g A l l _ N o d e s ( )
V e r ifi c a t i o n ( ) C o ll e c t in g V a li d N oG deet (_) IP A d d r e s s ( )
V e r i fi c a t io n ( )
D is t rib u tio n () F a u lt _ D e t a il s ( ) M s g _ T r a n s fe r ( )
F o rg o t p a s s w o r d ( )
G e t _ S e r v e r_ N a m e F( )il e _ L e n g t h _ C a l c ( )
E r r o r _ T r a n s fe r ( )

Object Diagram:

Authentication

Server Clients

Node Distributed
Verification System

State Diagram:
Distribute and
localize the Error sending
fault
For Server

Authentication

Verify the user

Collecting all
Nodes

Check and Store


the faults

Distribute
Nodes

For Clients
For Clients

Authentication

Collect Valid
Nodes

Distribute file /
data

Error predict
and send
F or s erver

A uthentic ation

V erify the us er

Collec ting A ll
Nodes to verify

C hec k and S tore the


fault Details

D istribute the
valid nodes

Activity Diagram:

F o r C lie nts
F o r C lie nts

A u t hen t ic atio n

C o llec t valid node s


fro m s e rve r

D is trib ute F ile s

E rro r P re dic tio n


a nd d is tribu tio n

Sequence Diagram:
(i) Server:
Authentication Collect Nodes Checking the Fault Store the fault
from the network node Localization

Verify the user who is server or client

Collected nodes are sending to verification

Provide the fault details

Storing. . .

(ii)Clients:

Authentication Verify the user Collect the valid Distributed System Error Prediction and Distribute
nodes For File Sharing to localize the fault
Verification. . .

transfer a file to the valid node people

Verify the transaction while the application is running

Component Diagram:
Node Verfication and
Fault Localization

Server
Machine
Fault details
Authentication storing

Distributed System Collect


(Client System) Valid Nodes

Error Prediction

Data Flow Diagram:

Authentication

Server System Client System

Verified
Collect all the Verify the Collect
Distribute andall Node
nodes Collect only the
nodes from nodes to be localize the valid nodes
the network valid fault
Verifica
Authentication tion

Predict the Error and


E-R Diagram: Alarm
Localize in server
User Security
Management
side
name Details

Security
Code

Distributed Distribut
System ion

Collect
valid
nodes Error
Predication
System Architecture:

Authentication

Verification and Networ


Localization k

Database

Distributed
Distribute the valid
System
nodes

6. SYSTEM TESTING AND MAINTENANCE

Testing is vital to the success of the system. System testing makes a logical
assumption that if all parts of the system are correct, the goal will be successfully
achieved. In the testing process we test the actual system in an organization and gather
errors from the new system operates in full efficiency as stated. System testing is the
stage of implementation, which is aimed to ensuring that the system works accurately and
efficiently.
In the testing process we test the actual system in an organization and gather
errors from the new system and take initiatives to correct the same. All the front-end and
back-end connectivity are tested to be sure that the new system operates in full efficiency
as stated. System testing is the stage of implementation, which is aimed at ensuring that
the system works accurately and efficiently.

The main objective of testing is to uncover errors from the system. For the
uncovering process we have to give proper input data to the system. So we should have
more conscious to give input data. It is important to give correct inputs to efficient
testing.

Testing is done for each module. After testing all the modules, the modules are
integrated and testing of the final system is done with the test data, specially designed to
show that the system will operate successfully in all its aspects conditions. Thus the
system testing is a confirmation that all is correct and an opportunity to show the user that
the system works. Inadequate testing or non-testing leads to errors that may appear few
months later.

This will create two problems

Time delay between the cause and appearance of the problem. The effect of the
system errors on files and records within the system.

The purpose of the system testing is to consider all the likely variations to which
it will be suggested and push the system to its limits.

The testing process focuses on logical intervals of the software ensuring that all
the statements have been tested and on the function intervals (i.e.,) conducting tests to
uncover errors and ensure that defined inputs will produce actual results that agree with
the required results. Testing has to be done using the two common steps Unit testing and
Integration testing. In the project system testing is made as follows:

The procedure level testing is made first. By giving improper inputs, the errors
occurred are noted and eliminated. This is the final step in system life cycle. Here we
implement the tested error-free system into real-life environment and make necessary
changes, which runs in an online fashion. Here system maintenance is done every months
or year based on company policies, and is checked for errors like runtime errors, long run
errors and other maintenances like table verification and reports.

6.1. UNIT TESTING

Unit testing verification efforts on the smallest unit of software design, module.
This is known as “Module Testing”. The modules are tested separately. This testing is
carried out during programming stage itself. In these testing steps, each module is found
to be working satisfactorily as regard to the expected output from the module.

6.2. INTEGRATION TESTING

Integration testing is a systematic technique for constructing tests to uncover error


associated within the interface. In the project, all the modules are combined and then the
entire programmer is tested as a whole. In the integration-testing step, all the error
uncovered is corrected for the next testing steps.

7. SYSTEM IMPLEMENTATION

Implementation is the stage of the project when the theoretical design is turned
out into a working system. Thus it can be considered to be the most critical stage in
achieving a successful new system and in giving the user, confidence that the new system
will work and be effective.

The implementation stage involves careful planning, investigation of the existing


system and it’s constraints on implementation, designing of methods to achieve
changeover and evaluation of changeover methods.
Implementation is the process of converting a new system design into operation.
It is the phase that focuses on user training, site preparation and file conversion for
installing a candidate system. The important factor that should be considered here is that
the conversion should not disrupt the functioning of the organization.

Future Enhancement:
This work can be extended in several interesting ways. For example, including
other types of monitors would allow detailed analysis of the optical layer. Finally, the
proposed approach can be easily extended to other areas of monitoring and sensor data
reduction (assuming that appropriate propagation models are considered) including:
signal crosstalk monitoring, process monitoring and other related applications.
Applications:
The Fault Localization should be useful when we are transferring a secure data to
you people on the distributed network application. This should be very useful to find out
the fault of nodes which are using within the organization.
Conclusion:
This project is localizing the fault prediction in the network. we addressed the
important problem of optimizing the fault-localization in transparent all-optical networks
through minimization of activated optical monitoring equipment while maintaining full
localization coverage. We defined the construction of monitoring domains and proved
that such hierarchically distributed fault localization achieves identical fault-localization
as the centralized monitoring. We are proofed that Achieving accurate and efficient fault
localization in large transparent all-optical networks (TONs) is an important and
challenging problem due to unique fault-propagation, time constraints, and scalability
requirements.
References or Bibliography:
[1] M. Médard, D. Marquis, R. A. Barry, and S. G. Finn, “Security issues in all-optical
networks," IEEE Network Mag., vol. 11, no. 3, pp. 42–48, May/June 1997.
[2] C. Assi, Y. Ye, A. Shami, S. Dixit, and M. Ali, “Security in All-Optical Networks:
Failure and Attack Avoidance Using Self-Organization." in Proc. IEEE GLOBECOM,
2002, vol. 3, pp. 2676–2680.
[3] Y. Pointurier, M. Coates, and M. Rabbat, “Active monitoring of all optical
networks," in Proc. IEEE ICTON, 2008, pp. 169–172.
[4] Y. Hamazumi, M. Koga, K. Kawai, H. Ichino, and K. Sato, “Optical path fault
management in layered networks," in Proc. IEEE GLOBECOM, 1998, pp. 2309–2314.
[5] T. Y. Chow, F. Chudak, and A. M. French, “Fast optical layer mesh protection
using pre-cross-connected trails," IEEE/ACM Trans. Networking, vol. 12, no. 3,
pp. 539–548, 2004.

10. APPENDIX:

SCREEN SHOT:
DATA TABLE STUCTURE:

SENDER:
RECEIVER:

FILE TRANSFER TABLE:


SAMPLE CODING:
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;

namespace WindowsFormsApplication4
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
if (txtboxusername.Text == "ADMIN")
{
this.Hide();
Check obj = new Check();
obj.Show();
}
else
{

this.Hide();
SENDER.Connecting_People ppl = new
SENDER.Connecting_People();
ppl.Show();

private void Login_Load(object sender, EventArgs e)


{
txtboxusername.Focus();
}

private void linkLabel1_LinkClicked(object sender,


LinkLabelLinkClickedEventArgs e)
{
this.Hide();
Authentication.Sign_up obj = new
WindowsFormsApplication4.Authentication.Sign_up();
obj.Show();
}

private void linkLabel3_LinkClicked(object sender,


LinkLabelLinkClickedEventArgs e)
{
if (MessageBox.Show("Are you want to close this application
?", "Message Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
{

Application.Exit();

}
}

private void linkLabel2_LinkClicked(object sender,


LinkLabelLinkClickedEventArgs e)
{
this.Hide();
Authentication.Forgot_Password obj = new
Authentication.Forgot_Password();
obj.Show();
}
}
}

Signup:
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.Data.SqlClient;

namespace WindowsFormsApplication4.Authentication
{
public partial class Sign_up : Form
{
Connection con = new Connection();
SqlCommand cmd;
SqlDataReader rdr;
int affected;
public Sign_up()
{
InitializeComponent();
}

private void textBox2_TextChanged(object sender, EventArgs e)


{
//if (MessageBox.Show("Are you check your USER NAME is
Accepted or not ?","Message Alert",MessageBoxButtons.YesNo) ==
DialogResult.No)
//{
// txtboxpwd.Text = string.Empty;
// btncheck.Focus();

//}
}
private void btn_clear_Click(object sender, EventArgs e)
{
clear();
}

private void btn_save_Click(object sender, EventArgs e)


{

try
{
if (con.Connect_Database() == true)
{

string input = "'" + txtboxusername.Text + "','" +


txtboxretypepwd.Text + "','" + txtboxnumber.Text + "','" +
comboBox1.SelectedItem.ToString() + "','" + txtboxanswer.Text + "'";

cmd = new SqlCommand("Insert into


Authentication(user_name,password,contact_number,security_question,answ
er)values(" + input + ")", con.con);
affected = cmd.ExecuteNonQuery();
if (affected > 0)
{
MessageBox.Show("Your details are stored
successfully", "Message Alert", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
clear();
}
cmd.Dispose();
con.con.Close();
this.Hide();
Login obj = new Login();
obj.Show();

}
else
{
MessageBox.Show("Database has not open properly");

}
catch (Exception ex)
{

MessageBox.Show(ex.Message);

private void btncheck_Click(object sender, EventArgs e)


{

try
{
if (con.Connect_Database() == true)
{

if (txtboxusername.Text != string.Empty)
{

cmd = new SqlCommand("select user_name from


Authentication where user_name='" + txtboxusername.Text + "'", con.con);
rdr = cmd.ExecuteReader();
if (rdr.HasRows)
{
MessageBox.Show("Your user name is already
exist please give another one");
txtboxusername.Text = string.Empty;
txtboxusername.Focus();

}
else
{

MessageBox.Show("Your user name is


accepted", "Message Alert");
txtboxpwd.Focus();

}
cmd.Dispose();
con.con.Close();
}
else
{
MessageBox.Show("Please give username");
txtboxusername.Focus();

}
catch (Exception ex)
{

MessageBox.Show(ex.Message);

public void clear()


{

txtboxusername.Text = string.Empty;
txtboxpwd.Text = string.Empty;
txtboxretypepwd.Text = string.Empty;
txtboxnumber.Text = string.Empty;
comboBox1.Text = "-----Select Your Question-----";
txtboxanswer.Text = string.Empty;

}
}
}

Forgot Password:
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.Data.SqlClient;

namespace WindowsFormsApplication4.Authentication
{
public partial class Forgot_Password : Form
{
SqlCommand cmd;
SqlDataReader reader;
Connection dbconn = new Connection();
string username = string.Empty;
string pwd = string.Empty;

string question = string.Empty;


string answer = string.Empty;

public Forgot_Password()
{
InitializeComponent();
}

private void btngetpassword_Click(object sender, EventArgs e)


{
if (txtboxanswer.Text == answer.Trim().ToString())
{

if (MessageBox.Show("Your Password is " + pwd,


"Message Alert", MessageBoxButtons.OK) == DialogResult.OK)
{
this.Hide();
Login obj = new Login();
obj.Show();

}
else
{
MessageBox.Show("Your Answer is wrong./n Try
Again......");
txtboxanswer.Text = string.Empty;
txtboxanswer.Focus();

private void btncheck_Click(object sender, EventArgs e)


{
try
{
if (dbconn.Connect_Database() == true)
{
cmd = new SqlCommand("select
user_name,password,security_question,answer from authentication where
user_name='" + txtboxuser_name.Text + "'", dbconn.con);
reader=cmd.ExecuteReader();
if(reader.HasRows==true)
{
if(reader.Read())
{
username = reader["user_name"].ToString();
pwd = reader["password"].ToString();
question =
reader["security_question"].ToString();
answer = reader["answer"].ToString();
txtboxquestion.Text = question.ToString();
txtboxanswer.Focus();
}

}
else
{
MessageBox.Show("Please give your original
username");

}
else
{
MessageBox.Show("Database has not open properly");

}
catch (Exception ex)
{

MessageBox.Show(ex.Message);
}
}
}
}

Check:
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.Management;//using object query
using System.Net.NetworkInformation;//To ping opertaions
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;//To use Process class
using System.Data.SqlClient;

namespace WindowsFormsApplication4
{
public partial class Check : Form

{
Connection con = new Connection();
server se = new server();
int admin_status = 0;
//Int32 i = 0;
[DllImport("winmm.dll", SetLastError = true, CallingConvention
= CallingConvention.Winapi)]
static extern bool PlaySound(string pszSound,
IntPtr hMod, SoundFlags sf);
public enum SoundFlags : int
{
SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound not
found */
SND_MEMORY = 0x0004, /* pszSound points to a memory file */
SND_LOOP = 0x0008, /* loop the sound until next
sndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playing
sound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is
busy */
SND_ALIAS = 0x00010000, /* name is a registry alias */
SND_ALIAS_ID = 0x00110000, /* alias is a predefined ID */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom
*/
}
public static string str1, remoteMachineNameOrIP;
public Check()
{
InitializeComponent();
}
public class server
{
IPEndPoint ipend;
Socket sock;
public server()
{
ipend = new IPEndPoint(IPAddress.Any, 4646);
sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
//sock.Disconnect(true);
//sock.Close();
if (sock.Connected == false)
{

sock.Bind(ipend);
sock.Listen(100);

}
else
{

sock.Shutdown(SocketShutdown.Both);
sock.Close();

public static string curmsg;


public static string Client_hostname;
public static string userdata;
public static string ipas;
public void Startserver()
{
try
{
//byte[] res = new byte[1000];

Socket clientsock = sock.Accept();


byte[] clientdata = new byte[1024];
clientsock.Receive(clientdata);
// Play Sound. . .
PlaySound("D:\\BOOPATHI\\Error
Localization\\WindowsFormsApplication4\\AlarmTone\\alarm.wav",
IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
int length =
Convert.ToInt32(Encoding.ASCII.GetString(clientdata, 0, 4));
//int length = BitConverter.ToInt32(clientdata, 0);
Client_hostname =
Encoding.ASCII.GetString(clientdata, 4, length);
userdata = Encoding.ASCII.GetString(clientdata, 4 +
length, (clientdata.Length - (4 + length)));
//clientsock.Close();
}
catch (Exception ex)
{

MessageBox.Show(ex.Message.ToString());
}
Startserver();
}
}
private void Form1_Load(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
linkLabel1.Location = new System.Drawing.Point(417, 9);

this.Height = 540;
this.Width = 493;
gboxnetworkerror.Visible = false;

ObjectQuery objectQuery = new ObjectQuery("select * from


Win32_NetworkAdapter where NetConnectionStatus=2");// 2 means connected
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(objectQuery);

int connectedNetworks = searcher.Get().Count;

if (connectedNetworks == 0)
{
if (MessageBox.Show("CABLE IS UNPLUGED\n Can you want
to discard this application? \n\n Note: If you solved this problem
please click NO ", "Error Alert", MessageBoxButtons.YesNo) ==
DialogResult.Yes)
{

Application.Exit();

}
public void get()
{
try
{

remoteMachineNameOrIP = str1.ToString();
int timeOut = 5;
Ping ping = new Ping(); // Pinging remote
maching
PingReply reply = ping.Send(remoteMachineNameOrIP,
timeOut); // Displaying the result

StringBuilder sb = new StringBuilder();


sb.Append("Address:" +
remoteMachineNameOrIP.ToString());
sb.Append("\nStatus:" + reply.Status.ToString());//Get
the status of the remote system
sb.Append("\nRoundtripTime:" +
reply.RoundtripTime.ToString());//calculate timetaken for get status of
the remote system

//MessageBox.Show(sb.ToString(), "Ping Result: " +


remoteMachineNameOrIP);

catch (Exception ex)


{
//PlaySound("alarm.wav", IntPtr.Zero,
SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
PlaySound("D:\\BOOPATHI\\Error
Localization\\WindowsFormsApplication4\\AlarmTone\\alarm.wav",
IntPtr.Zero, SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);

if (MessageBox.Show(ex.Message.ToString(), "Problem on "


+ remoteMachineNameOrIP) == DialogResult.OK)
{
listBox2.Items.Add(remoteMachineNameOrIP.ToString()
);

}
//listBox2.Items.Add(remoteMachineNameOrIP.ToString());
}

}
public void Get_Host_Names()
{

//Gets the machine names that are connected on LAN

Process netUtility = new Process();

netUtility.StartInfo.FileName = "net.exe"; //Give


application to start

netUtility.StartInfo.CreateNoWindow = true; //It is not


allow this process in another window

netUtility.StartInfo.Arguments = "view"; //Gets the values


from there

netUtility.StartInfo.RedirectStandardOutput = true; //set


the output of the application to write in Stream

netUtility.StartInfo.UseShellExecute = false; //To use the


OS shell to start the execution
netUtility.StartInfo.RedirectStandardError = true; //To
indication of errors while the application is process

netUtility.Start();

StreamReader streamReader = new


StreamReader(netUtility.StandardOutput.BaseStream,
netUtility.StandardOutput.CurrentEncoding);

string line = "";

while ((line = streamReader.ReadLine()) != null)


{

if (line.StartsWith("\\"))
{

listBox1.Items.Add(line.Substring(2).Substring(0,
line.Substring(2).IndexOf(" ")).ToUpper());

streamReader.Close();
netUtility.WaitForExit(500); //wait some milliseconds for
existing the execution

}
private void button1_Click(object sender, EventArgs e)
{
admin_status = 1;
listBox1.Items.Clear();
listBox2.Items.Clear();

Get_Host_Names();

//timer1.Enabled = true;
//lblmsg.Text = "Starting. . .";
for (int i = 0; i < listBox1.Items.Count; i++)
{
str1 = listBox1.Items[i].ToString();
get();
}
lblmessage.Text = "Status :Process is Completed";
if (MessageBox.Show("Can You want to distribute these valid
systems to your Clients and store the fault details in your database?",
"Message Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
Connection obj = new Connection();
SqlCommand cmd;
int count = 0;
store_Fault_Details();
if (obj.Connect_Database() == true)
{
SqlCommand cmd2 = new SqlCommand("DELETE FROM
Valid_Nodes", obj.con);
cmd2.ExecuteNonQuery();
cmd2.Dispose();
lblmessage.Text = "Status :Valid Nodes are
distributing. . .";
for (int i = 0; i < listBox1.Items.Count; i++)
{
for (int j = 0; j < listBox2.Items.Count; j++)
{

if (listBox1.Items[i].ToString() ==
listBox2.Items[j].ToString())
{
count = 1;

}
if (count == 0)
{
try
{
cmd = new SqlCommand("INSERT INTO
Valid_Nodes(Admin_Status,Valid_nodes,Server_Name)VALUES(" +
admin_status + ",'" + listBox1.Items[i].ToString() + "','" +
Dns.GetHostName().ToString() + "')", obj.con);
cmd.ExecuteNonQuery();
cmd.Dispose();
lblmessage.Text = "Status :Valid nodes
are distributed";
}

catch (Exception ex)


{

lblmessage.Text = ex.Message.ToString();

else
{

count = 0;
}

}
con.con.Close();

}
else
{
MessageBox.Show("Database is not open");
}

}
private void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
//IPEndPoint ipend = new IPEndPoint(IPAddress.Any, 4544);
//Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
//sock.Shutdown(SocketShutdown.Both);
//sock.Close();
//sock.Bind(ipend);
if (MessageBox.Show("Are You want to close this
application?", "Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
Application.Exit();
}
//Login obj = new Login();
//obj.Show();
}
private void listBox2_SelectedIndexChanged(object sender,
EventArgs e)
{
linkLabel1.Location = new System.Drawing.Point(903, 28);
this.Height = 487;
this.Width = 1020;
gboxnetworkerror.Visible = true;
lblhostname.Text = listBox2.SelectedItem.ToString();
lblipaddress.Text = "The Hostname has No Network";
lblstatus.Text = "Destination host unreachable";

}
private void backgroundWorker1_DoWork(object sender,
System.ComponentModel.DoWorkEventArgs e)
{
se.Startserver();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (server.userdata != null && server.Client_hostname!=null)
{
//label9.Text = server.userdata.ToString();
lblclient_Name.Text = server.Client_hostname.ToString();
label9.Text = server.userdata.ToString();
}
}
private void timer2_Tick(object sender, EventArgs e)
{
string time = DateTime.Now.ToShortTimeString();
string date=DateTime.Now.ToShortDateString();
if (con.Connect_Database() == true)
{
if (server.Client_hostname != null && server.userdata !
= null)
{
SqlCommand cmd = new SqlCommand("Insert into
Fault_Details(System_Name,Fault_Status,Fault_Details,Time,date)values('"
+ lblclient_Name.Text + "'," + 1 + ",'" + label9.Text + "','" + time +
"','" + date + ")", con.con);
int affected = cmd.ExecuteNonQuery();
if (affected > 0)
{
lblclient_Name.Text = "Null";
label9.Text = "Null";

}
}
private void linkLabel2_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
Fault_Area fault_ob = new Fault_Area();
fault_ob.Show();
this.Hide();
}

//private void timer1_Tick(object sender, EventArgs e)


//{
// listBox2.Items.Clear();
// if (progressBar1.Value == progressBar1.Maximum)
// {
// lblmsg.Text = "Completed";
// progressBar1.Value = progressBar1.Minimum;

// }
// else
// {
// //listBox1.Items.Clear();
// //listBox2.Items.Clear();
// for (int i = 0; i < listBox1.Items.Count; i++)
// {
// str1 = listBox1.Items[i].ToString();
// get();
// lblmsg.Text = "Processing. . .";

// //lblmsg.Text = progressBar1.Value.ToString();

// }
// progressBar1.Value = progressBar1.Value +50;
// //listBox2.Items.Clear();
// }

//}

public void store_Fault_Details()


{
string Fault_Details = string.Empty;
Fault_Details = "The Node is Unreachable";
string time = DateTime.Now.ToShortTimeString();
string date = DateTime.Now.ToShortDateString();
int count = 0;
if (con.Connect_Database() == true)
{

for (int i = 0; i < listBox1.Items.Count; i++)


{

for (int j = 0; j < listBox2.Items.Count; j++)


{

if (listBox1.Items[i].ToString() ==
listBox2.Items[j].ToString())
{
SqlCommand cmd2 = new SqlCommand("INSERT
INTO
fault_details(System_Name,Fault_Details,Fault_Status,Time,date)VALUES('"
+ listBox1.Items[i].ToString() + "','" + Fault_Details + "','1','" +
time + "','" + date + "')", con.con);
cmd2.ExecuteNonQuery();
cmd2.Dispose();
lblmessage.Text = "Status :Fault Details
are Stored";

count = 1;

}
if (count == 0)
{

try
{
SqlCommand cmd1 = new SqlCommand("INSERT
INTO
fault_details(System_Name,Fault_Details,Fault_Status,Time,date)VALUES('"
+ listBox1.Items[i].ToString() + "','Null','0','"+time+"','"+date+"')",
con.con);
cmd1.ExecuteNonQuery();
cmd1.Dispose();
lblmessage.Text = "Status :Fault Details
are Stored";
}

catch (Exception ex)


{
lblmessage.Text = ex.Message.ToString();

else
{

count = 0;
}

con.con.Close();
}

}
}

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.Management;//using object query
using System.Net.NetworkInformation;//To ping opertaions
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;//To use Process class
using System.Data.SqlClient;

namespace WindowsFormsApplication4
{
public partial class Check : Form

{
Connection con = new Connection();
server se = new server();
int admin_status = 0;
//Int32 i = 0;
[DllImport("winmm.dll", SetLastError = true, CallingConvention
= CallingConvention.Winapi)]
static extern bool PlaySound(string pszSound,
IntPtr hMod, SoundFlags sf);
public enum SoundFlags : int
{
SND_SYNC = 0x0000, /* play synchronously (default) */
SND_ASYNC = 0x0001, /* play asynchronously */
SND_NODEFAULT = 0x0002, /* silence (!default) if sound not
found */
SND_MEMORY = 0x0004, /* pszSound points to a memory file */
SND_LOOP = 0x0008, /* loop the sound until next
sndPlaySound */
SND_NOSTOP = 0x0010, /* don't stop any currently playing
sound */
SND_NOWAIT = 0x00002000, /* don't wait if the driver is
busy */
SND_ALIAS = 0x00010000, /* name is a registry alias */
SND_ALIAS_ID = 0x00110000, /* alias is a predefined ID */
SND_FILENAME = 0x00020000, /* name is file name */
SND_RESOURCE = 0x00040004 /* name is resource name or atom
*/
}
public static string str1, remoteMachineNameOrIP;
public Check()
{
InitializeComponent();
}
public class server
{
IPEndPoint ipend;
Socket sock;
public server()
{
ipend = new IPEndPoint(IPAddress.Any, 4646);
sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
//sock.Disconnect(true);
//sock.Close();
if (sock.Connected == false)
{

sock.Bind(ipend);
sock.Listen(100);

}
else
{

sock.Shutdown(SocketShutdown.Both);
sock.Close();

public static string curmsg;


public static string Client_hostname;
public static string userdata;
public static string ipas;
public void Startserver()
{
try
{
//byte[] res = new byte[1000];

Socket clientsock = sock.Accept();


byte[] clientdata = new byte[1024];
clientsock.Receive(clientdata);
// Play Sound. . .
PlaySound("D:\\BOOPATHI\\ITDNW01-
boopathi\\WindowsFormsApplication4\\AlarmTone\\alarm.wav", IntPtr.Zero,
SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
int length =
Convert.ToInt32(Encoding.ASCII.GetString(clientdata, 0, 4));
//int length = BitConverter.ToInt32(clientdata, 0);
Client_hostname =
Encoding.ASCII.GetString(clientdata, 4, length);
userdata = Encoding.ASCII.GetString(clientdata, 4 +
length, (clientdata.Length - (4 + length)));
//clientsock.Close();

}
catch (Exception ex)
{

MessageBox.Show(ex.Message.ToString());
}
Startserver();
}
}
private void Form1_Load(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
linkLabel1.Location = new System.Drawing.Point(417, 9);

this.Height = 540;
this.Width = 493;
gboxnetworkerror.Visible = false;

ObjectQuery objectQuery = new ObjectQuery("select * from


Win32_NetworkAdapter where NetConnectionStatus=2");// 2 means connected
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(objectQuery);

int connectedNetworks = searcher.Get().Count;

if (connectedNetworks == 0)
{
if (MessageBox.Show("CABLE IS UNPLUGED\n Can you want
to discard this application? \n\n Note: If you solved this problem
please click NO ", "Error Alert", MessageBoxButtons.YesNo) ==
DialogResult.Yes)
{

Application.Exit();
}

}
public void get()
{
try
{

remoteMachineNameOrIP = str1.ToString();
int timeOut = 5;
Ping ping = new Ping(); // Pinging remote
maching
PingReply reply = ping.Send(remoteMachineNameOrIP,
timeOut); // Displaying the result

StringBuilder sb = new StringBuilder();


sb.Append("Address:" +
remoteMachineNameOrIP.ToString());
sb.Append("\nStatus:" + reply.Status.ToString());//Get
the status of the remote system
sb.Append("\nRoundtripTime:" +
reply.RoundtripTime.ToString());//calculate timetaken for get status of
the remote system

//MessageBox.Show(sb.ToString(), "Ping Result: " +


remoteMachineNameOrIP);

catch (Exception ex)


{
//PlaySound("alarm.wav", IntPtr.Zero,
SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);
PlaySound("D:\\BOOPATHI\\ITDNW01-
boopathi\\WindowsFormsApplication4\\AlarmTone\\alarm.wav", IntPtr.Zero,
SoundFlags.SND_FILENAME | SoundFlags.SND_ASYNC);

if (MessageBox.Show(ex.Message.ToString(), "Problem on "


+ remoteMachineNameOrIP) == DialogResult.OK)
{
listBox2.Items.Add(remoteMachineNameOrIP.ToString()
);

}
//listBox2.Items.Add(remoteMachineNameOrIP.ToString());
}

}
public void Get_Host_Names()
{

//Gets the machine names that are connected on LAN

Process netUtility = new Process();

netUtility.StartInfo.FileName = "net.exe"; //Give


application to start

netUtility.StartInfo.CreateNoWindow = true; //It is not


allow this process in another window

netUtility.StartInfo.Arguments = "view"; //Gets the values


from there

netUtility.StartInfo.RedirectStandardOutput = true; //set


the output of the application to write in Stream

netUtility.StartInfo.UseShellExecute = false; //To use the


OS shell to start the execution

netUtility.StartInfo.RedirectStandardError = true; //To


indication of errors while the application is process

netUtility.Start();

StreamReader streamReader = new


StreamReader(netUtility.StandardOutput.BaseStream,
netUtility.StandardOutput.CurrentEncoding);

string line = "";

while ((line = streamReader.ReadLine()) != null)


{

if (line.StartsWith("\\"))
{

listBox1.Items.Add(line.Substring(2).Substring(0,
line.Substring(2).IndexOf(" ")).ToUpper());

streamReader.Close();
netUtility.WaitForExit(500); //wait some milliseconds for
existing the execution

}
private void button1_Click(object sender, EventArgs e)
{
admin_status = 1;
listBox1.Items.Clear();
listBox2.Items.Clear();

Get_Host_Names();

//timer1.Enabled = true;
//lblmsg.Text = "Starting. . .";
for (int i = 0; i < listBox1.Items.Count; i++)
{
str1 = listBox1.Items[i].ToString();
get();
}
lblmessage.Text = "Status :Process is Completed";
if (MessageBox.Show("Can You want to distribute these valid
systems to your Clients and store the fault details in your database?",
"Message Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
Connection obj = new Connection();
SqlCommand cmd;
int count = 0;

store_Fault_Details();
if (obj.Connect_Database() == true)
{
SqlCommand cmd2 = new SqlCommand("DELETE FROM
Valid_Nodes", obj.con);
cmd2.ExecuteNonQuery();
cmd2.Dispose();
lblmessage.Text = "Status :Valid Nodes are
distributing. . .";
for (int i = 0; i < listBox1.Items.Count; i++)
{
for (int j = 0; j < listBox2.Items.Count; j++)
{

if (listBox1.Items[i].ToString() ==
listBox2.Items[j].ToString())
{
count = 1;

}
if (count == 0)
{
try
{
cmd = new SqlCommand("INSERT INTO
Valid_Nodes(Admin_Status,Valid_nodes,Server_Name)VALUES(" +
admin_status + ",'" + listBox1.Items[i].ToString() + "','" +
Dns.GetHostName().ToString() + "')", obj.con);
cmd.ExecuteNonQuery();
cmd.Dispose();
lblmessage.Text = "Status :Valid nodes
are distributed";
}
catch (Exception ex)
{

lblmessage.Text = ex.Message.ToString();

else
{

count = 0;
}

}
con.con.Close();

}
else
{
MessageBox.Show("Database is not open");
}

}
private void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
//IPEndPoint ipend = new IPEndPoint(IPAddress.Any, 4544);
//Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
//sock.Shutdown(SocketShutdown.Both);
//sock.Close();
//sock.Bind(ipend);
if (MessageBox.Show("Are You want to close this
application?", "Alert", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
Application.Exit();
}
//Login obj = new Login();
//obj.Show();
}
private void listBox2_SelectedIndexChanged(object sender,
EventArgs e)
{
linkLabel1.Location = new System.Drawing.Point(903, 28);
this.Height = 487;
this.Width = 1020;
gboxnetworkerror.Visible = true;
lblhostname.Text = listBox2.SelectedItem.ToString();
lblipaddress.Text = "The Hostname has No Network";
lblstatus.Text = "Destination host unreachable";

}
private void backgroundWorker1_DoWork(object sender,
System.ComponentModel.DoWorkEventArgs e)
{
se.Startserver();
}
private void timer1_Tick(object sender, EventArgs e)
{
if (server.userdata != null && server.Client_hostname!=null)
{
//label9.Text = server.userdata.ToString();
lblclient_Name.Text = server.Client_hostname.ToString();
label9.Text = server.userdata.ToString();
}
}
private void timer2_Tick(object sender, EventArgs e)
{
string time = DateTime.Now.ToShortTimeString();
string date=DateTime.Now.ToShortDateString();
if (con.Connect_Database() == true)
{
if (server.Client_hostname != null && server.userdata !
= null)
{
SqlCommand cmd = new SqlCommand("Insert into
Fault_Details(System_Name,Fault_Status,Fault_Details,Time,date)values('"
+ lblclient_Name.Text + "'," + 1 + ",'" + label9.Text + "','" + time +
"','" + date + ")", con.con);
int affected = cmd.ExecuteNonQuery();
if (affected > 0)
{
lblclient_Name.Text = "Null";
label9.Text = "Null";

}
}
private void linkLabel2_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
Fault_Area fault_ob = new Fault_Area();
fault_ob.Show();
this.Hide();
}

//private void timer1_Tick(object sender, EventArgs e)


//{
// listBox2.Items.Clear();
// if (progressBar1.Value == progressBar1.Maximum)
// {
// lblmsg.Text = "Completed";
// progressBar1.Value = progressBar1.Minimum;

// }
// else
// {
// //listBox1.Items.Clear();
// //listBox2.Items.Clear();
// for (int i = 0; i < listBox1.Items.Count; i++)
// {
// str1 = listBox1.Items[i].ToString();
// get();
// lblmsg.Text = "Processing. . .";

// //lblmsg.Text = progressBar1.Value.ToString();

// }
// progressBar1.Value = progressBar1.Value +50;
// //listBox2.Items.Clear();

// }

//}

public void store_Fault_Details()


{
string Fault_Details = string.Empty;
Fault_Details = "The Node is Unreachable";
string time = DateTime.Now.ToShortTimeString();
string date = DateTime.Now.ToShortDateString();
int count = 0;
if (con.Connect_Database() == true)
{

for (int i = 0; i < listBox1.Items.Count; i++)


{

for (int j = 0; j < listBox2.Items.Count; j++)


{

if (listBox1.Items[i].ToString() ==
listBox2.Items[j].ToString())
{
SqlCommand cmd2 = new SqlCommand("INSERT
INTO
fault_details(System_Name,Fault_Details,Fault_Status,Time,date)VALUES('"
+ listBox1.Items[i].ToString() + "','" + Fault_Details + "','1','" +
time + "','" + date + "')", con.con);
cmd2.ExecuteNonQuery();
cmd2.Dispose();
lblmessage.Text = "Status :Fault Details
are Stored";

count = 1;

}
}
if (count == 0)
{

try
{
SqlCommand cmd1 = new SqlCommand("INSERT
INTO
fault_details(System_Name,Fault_Details,Fault_Status,Time,date)VALUES('"
+ listBox1.Items[i].ToString() + "','Null','0','"+time+"','"+date+"')",
con.con);
cmd1.ExecuteNonQuery();
cmd1.Dispose();
lblmessage.Text = "Status :Fault Details
are Stored";
}

catch (Exception ex)


{

lblmessage.Text = ex.Message.ToString();

else
{

count = 0;
}

con.con.Close();
}

}
}

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.Net.Sockets;
using System.Configuration;
using System.IO;
using System.Data.SqlClient;
using System.Threading;
using System.Management;

namespace WindowsFormsApplication4.SENDER
{
public partial class Connecting_People : Form
{
string Server_Name = string.Empty;
string selectedfile = string.Empty;
string stripaddress = string.Empty;
server se = new server();
//recie re = new recie();
Connection dbconn = new Connection();
//Int32 Count = 0;
DataSet dset = new DataSet();
public Connecting_People()
{
InitializeComponent();
}

private void Connecting_People_Load(object sender, EventArgs e)


{
try
{
ObjectQuery objectQuery = new ObjectQuery("select *
from Win32_NetworkAdapter where NetConnectionStatus=2");// 2 means
connected
ManagementObjectSearcher searcher = new
ManagementObjectSearcher(objectQuery);

int connectedNetworks = searcher.Get().Count;

if (connectedNetworks == 0)
{

throw new Exception("This System Cable is


UNPLUGED");
}
}
catch (Exception exx)
{
// MessageBox.Show(exx.Message.ToString());
try
{
if (dbconn.Connect_Database() == true)
{
SqlCommand cmd = new SqlCommand("select
Server_Name from valid_Nodes", dbconn.con);
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read() == true)
{
Server_Name = rdr[0].ToString();
}
IPAddress[] ipaddress =
Dns.GetHostAddresses(Server_Name);
IPEndPoint ipend = new IPEndPoint(ipaddress[1],
4646);

Socket clientsock = new


Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
byte[] system_name =
Encoding.ASCII.GetBytes(Dns.GetHostName());
byte[] file_length =
Encoding.ASCII.GetBytes(system_name.Length.ToString());
byte[] filedata =
Encoding.ASCII.GetBytes(exx.Message.ToString());
byte[] error_details = new byte[4 +
system_name.Length + filedata.Length];
file_length.CopyTo(error_details, 0);

system_name.CopyTo(error_details, 4);
filedata.CopyTo(error_details, 4 +
system_name.Length);
clientsock.Connect(ipend);//Establish a
connection to a remote system
clientsock.Send(error_details);
}

}
catch (Exception err)
{
MessageBox.Show(err.Message.ToString());

}
backgroundWorker1.RunWorkerAsync();//Here only the
backgroud control is start to running
comboBox1.Items.Clear();
cmboxsend_to_whom.Items.Clear();

if (dbconn.Connect_Database() == true)
{
try
{
SqlCommand cmd = new SqlCommand("select valid_nodes
from valid_nodes", dbconn.con);
SqlDataReader read;
read = cmd.ExecuteReader();

while (read.Read())
{
comboBox1.Items.Add(read[0].ToString().Trim());
cmboxsend_to_whom.Items.Add(read[0].ToString().
Trim());
}

read.Dispose();
cmd.Dispose();
dbconn.con.Close();

}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());

else
{
if (MessageBox.Show("Server is not Active So Try
Again . . .") == DialogResult.OK)
{

Application.Exit();
}
}

public class server


{
IPEndPoint ipend;
Socket sock;
public server()
{
ipend = new IPEndPoint(IPAddress.Any, 4646);
sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
//sock.Disconnect(true);
//sock.Close();
if (sock.Connected == false)
{

sock.Bind(ipend);
//sock.Listen(100);

}
else
{

sock.Shutdown(SocketShutdown.Both);
sock.Close();

}
//public static string receivedpath = @"E:\copy";
public static string curmsg;
public static string username;
public static string ipas;
public void Startserver()
{
try
{
byte[] res = new byte[1000];
curmsg = "Starting....";
sock.Listen(100);
curmsg = "Running and waiting to receive file";
Socket clientsock = sock.Accept();
byte[] clientdata = new byte[1024 * 5000];
int receiveByteLen = clientsock.Receive(clientdata);
curmsg = "Receiving data";
int FileNameLen = BitConverter.ToInt32(clientdata,
0);
// ipas = sock.RemoteEndPoint.ToString();
username = Encoding.ASCII.GetString(clientdata, 4,
clientdata.Length - 4);
//string passward =
Encoding.ASCII.GetString(clientdata, 4 + FileNameLen, receiveByteLen -
4 - FileNameLen);
string[] s = username.Split(':');

clientsock.Close();

}
catch (Exception ex)
{
//curmsg = "file receiving error" + ex.Message;
MessageBox.Show(ex.Message.ToString());
}
Startserver();
}
}

private void button1_Click(object sender, EventArgs e)


{
if (comboBox1.Text != "----SELECT----")
{
try
{
textBox1.Text = textBox1.Text + "\r\n " +
Dns.GetHostName().ToString() + " :" + textBox2.Text;
//textBox1.Text = textBox1.Text + "\r\n " +
comboBox1.SelectedItem.ToString() + " :" + textBox2.Text;
IPAddress[] ipaddress =
Dns.GetHostAddresses(comboBox1.SelectedItem.ToString());
IPEndPoint ipend = new IPEndPoint(ipaddress[0],
4646);
// MessageBox.Show("connect to system");
Socket clientsock = new
Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
//string pathname = "your path name";
byte[] fileNameByte =
Encoding.ASCII.GetBytes(Dns.GetHostName().ToString() + " :" +
textBox2.Text);
//byte[] filedata =
Encoding.ASCII.GetBytes(textBox1.Text);
byte[] clientdata = new byte[4 +
fileNameByte.Length];
byte[] filenamelen =
BitConverter.GetBytes(fileNameByte.Length);
filenamelen.CopyTo(clientdata, 0);
fileNameByte.CopyTo(clientdata, 4);
clientsock.Connect(ipend);//Establish a connection
to a remote system
clientsock.Send(clientdata);

clientsock.Receive(clientdata);
string username1 =
Encoding.ASCII.GetString(clientdata, 0, 4);

if (username1 == "wait")
{
MessageBox.Show("wait for some time");
}

// label2.Text = "file has been send to server";


textBox2.Text = " ";
}
catch (Exception ex)
{
// MessageBox.Show(ex.Message.ToString());
try
{
if (dbconn.Connect_Database() == true)
{
SqlCommand cmd = new SqlCommand("select
Server_Name from valid_Nodes", dbconn.con);
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read() == true)
{
Server_Name = rdr[0].ToString();
}
IPAddress[] ipaddress =
Dns.GetHostAddresses(Server_Name);
IPEndPoint ipend = new
IPEndPoint(ipaddress[0], 4646);

Socket clientsock = new


Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
byte[] system_name =
Encoding.ASCII.GetBytes(Dns.GetHostName());
byte[] file_length =
Encoding.ASCII.GetBytes(system_name.Length.ToString());
byte[] filedata =
Encoding.ASCII.GetBytes(ex.Message.ToString());
byte[] error_details = new byte[4 +
system_name.Length + filedata.Length];
file_length.CopyTo(error_details, 0);

system_name.CopyTo(error_details, 4);
filedata.CopyTo(error_details, 4 +
system_name.Length);
clientsock.Connect(ipend);//Establish a
connection to a remote system
clientsock.Send(error_details);
}

}
catch (Exception exx)
{
MessageBox.Show(exx.Message.ToString());

}
}

else
{
MessageBox.Show("Please Select anyone to discussion");
comboBox1.Focus();

private void backgroundWorker1_DoWork(object sender,


DoWorkEventArgs e)
{
se.Startserver();
}

private void timer1_Tick(object sender, EventArgs e)


{
comboBox1.Items.Clear();
cmboxsend_to_whom.Items.Clear();

if (dbconn.Connect_Database() == true)
{
try
{
SqlCommand cmd = new SqlCommand("select valid_nodes
from valid_nodes", dbconn.con);
SqlDataReader read;
read = cmd.ExecuteReader();

while (read.Read())
{
comboBox1.Items.Add(read[0].ToString().Trim());
cmboxsend_to_whom.Items.Add(read[0].ToString().
Trim());

read.Dispose();
cmd.Dispose();
dbconn.con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());

private void comboBox1_SelectedIndexChanged(object sender,


EventArgs e)
{

if (comboBox1.SelectedIndex != -1)
{
try
{
IPAddress[] ipaddress =
Dns.GetHostAddresses(comboBox1.SelectedItem.ToString());
stripaddress = ipaddress.GetValue(1).ToString();
textBox2.Focus();
}
catch (Exception)
{
comboBox1.Focus();

}
}
}
private void linkLabel1_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e)
{
//this.Hide();
//Login obj = new Login();
//obj.Show();
Application.Exit();
}
private void btnselectfile_Click(object sender, EventArgs e)
{
OpenFileDialog obj_open_file = new OpenFileDialog();
if (obj_open_file.ShowDialog() == DialogResult.OK)
{
txtboxselectfile.Text =
obj_open_file.FileName.ToString();

}
}
private void btnsendfile_Click(object sender, EventArgs e)
{
//timer1.Enabled = false;
if (cmboxsend_to_whom.SelectedIndex != -1)
{
try
{

string str = string.Empty;


str = txtboxselectfile.Text;
//int index = str.LastIndexOf("\\");
//str = "\\Boopathi.doc";
FileInfo info = new FileInfo(str);
long size = info.Length / 1024;//size in KB
if (size >= 1024)//Above 1MB file is not allowed
{
throw new Exception("The Sender sending file
size is too long ");
}
int index = str.LastIndexOf("\\");
index = index + 1;
string sub = str.Substring((index), (str.Length -
index));
string host_name =
cmboxsend_to_whom.SelectedItem.ToString();
if (File.Exists("\\\\" + host_name + "/Share
Folder/" + sub + "") == true)
{
MessageBox.Show("This File is already Exist.You
just rename that file or send another file");

}
else
{

File.Copy(str, "\\\\" + host_name + "/Share


Folder/" + sub + "");
MessageBox.Show("Successfully Transfered to " +
cmboxsend_to_whom.SelectedItem.ToString());
cmboxsend_to_whom.Focus();

}
catch (Exception ex)
{
//MessageBox.Show(ex.Message.ToString());
try
{
if (dbconn.Connect_Database() == true)
{
SqlCommand cmd = new SqlCommand("select
Server_Name from valid_Nodes", dbconn.con);
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read() == true)
{
Server_Name = rdr[0].ToString();
}
IPAddress[] ipaddress =
Dns.GetHostAddresses(Server_Name);
IPEndPoint ipend = new
IPEndPoint(ipaddress[1], 5000);

Socket clientsock = new


Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

byte[] filedata =
Encoding.ASCII.GetBytes(ex.Message.ToString());

clientsock.Connect(ipend);//Establish a
connection to a remote system
clientsock.Send(filedata);
}

}
catch (Exception exx)
{
MessageBox.Show(exx.Message.ToString());

}
}

else
{
cmboxsend_to_whom.Focus();

}
private void timer2_Tick(object sender, EventArgs e)
{
if (server.username != null)
{
textBox1.Text = textBox1.Text + "\r\n " + server.ipas +
server.username;
server.username = null;
textBox1.SelectionStart = textBox1.TextLength;

textBox1.ScrollToCaret();
textBox2.Show();
}
}

}
}