Beruflich Dokumente
Kultur Dokumente
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
1 .NET FRAMEWORK 10
2 INTEROPERABILITY 12
ACTIVE MONITORING AND ALARM MANAGEMENT
FOR FAULT LOCALIZATION IN TRANSPARENT ALL-
OPTICAL NETWORKS
ABSTRACT:
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
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.
3. SYSTEM SPECIFICATION
SOFTWARE REQUIREMENTS:
• Operating system :- Windows 07& XP
• Front End :- Visual Studio 2008, C#.Net,
• Backend :- SQL Server 2005
HARDWARE REQUIREMENTS:
4. LANGAUGE SPECIFICATION
The CLR is described as the “execution engine” of .NET. It provides the environment
within which programs run. The most important features are
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.
GARBAGE COLLECTION
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
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.
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:
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:
Valid Nodes
Checking
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
Collecting all
Nodes
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
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
Sequence Diagram:
(i) Server:
Authentication Collect Nodes Checking the Fault Store the fault
from the network node Localization
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. . .
Component Diagram:
Node Verfication and
Fault Localization
Server
Machine
Fault details
Authentication storing
Error Prediction
Authentication
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
Security
Code
Distributed Distribut
System ion
Collect
valid
nodes Error
Predication
System Architecture:
Authentication
Database
Distributed
Distribute the valid
System
nodes
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.
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.
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.
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.
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:
namespace WindowsFormsApplication4
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
this.Hide();
SENDER.Connecting_People ppl = new
SENDER.Connecting_People();
ppl.Show();
Application.Exit();
}
}
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 btn_clear_Click(object sender, EventArgs e)
{
clear();
}
try
{
if (con.Connect_Database() == true)
{
}
else
{
MessageBox.Show("Database has not open properly");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
try
{
if (con.Connect_Database() == true)
{
if (txtboxusername.Text != string.Empty)
{
}
else
{
}
cmd.Dispose();
con.con.Close();
}
else
{
MessageBox.Show("Please give username");
txtboxusername.Focus();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
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;
public Forgot_Password()
{
InitializeComponent();
}
}
else
{
MessageBox.Show("Your Answer is wrong./n Try
Again......");
txtboxanswer.Text = string.Empty;
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();
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;
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
}
//listBox2.Items.Add(remoteMachineNameOrIP.ToString());
}
}
public void Get_Host_Names()
{
netUtility.Start();
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";
}
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();
}
// }
// 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();
// }
//}
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";
}
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();
}
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;
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
}
//listBox2.Items.Add(remoteMachineNameOrIP.ToString());
}
}
public void Get_Host_Names()
{
netUtility.Start();
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();
}
// }
// 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();
// }
//}
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";
}
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();
}
if (connectedNetworks == 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();
}
}
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();
}
}
clientsock.Receive(clientdata);
string username1 =
Encoding.ASCII.GetString(clientdata, 0, 4);
if (username1 == "wait")
{
MessageBox.Show("wait for some time");
}
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();
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());
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
{
}
else
{
}
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);
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();
}
}
}
}