Network Load Manager
Network Load Manager
ABSTRACT
In this report, we describe the process of developing a Network Load Balancing system
from design to implementation.
When a single Server machine isn't enough to handle the traffic on the network tit's time to look
l
into building a web Farm that uses multiple machines on the network acting as a single server. A
Web Farm is a not so fancy term for a collection of servers [that act as a single Web server.
Administration of two or more servers and keeping them properly synched is actually a lot more
work than administering a single server.
The Load Balancing can also provide benefits in the overload scenario. For one, tit's
generally cheaper to throw mid-level machines at a load problem rather than buying lone top of
the line high end machine.
project Report - June 2006 Network Load Manager
CONTENTS
3.1 Introduction
3.1.1 Purpose
3.1.2 Scope
SCREEN SHOTS 30
CONCLUSION
INTRODUCTION
In this report, we describe the process of developing a Network Load Balancing system
When a single Server machine isn't enough to handle the traffic on the network [ it's time
to look into building a web Farm that uses multiple machines on the network
acting as a single server. A Web Farm is a not so fancy term for a collection of servers [that act
as a single Web server. Administration of two or more servers and keeping
them properly synched is actually a lot more work than administering a single server.
The Load Balancing can also provide benefits in the overload scenario. For one, [it's
generally cheaper to throw mid-level machines at a load problem rather than buying [one top of
the line high end machine.
Load Balancing also provides something else that has nothing to do with scalability: [The
ability to have failover support if something goes wrong on one of the servers in the fpool.
Because a Web Farm is made up of essentially identically configured servers, a failure on a single
server will not bring down the entire server contents. Other servers in pie pool can continue to
process requests and pick up the slack. For many companies f this feature of load balancing is
often important for peace of mind both in the knowledge [that a single point of failure on the Server
is avoided as well as providing an in place thechanism to grow the application should the need
arise at a later point.
1. INTRODUCTION
1.1Purpose
1.2 Scope
This document is the only one that describes the requirements of the system. It meant for
use by the developers and will be the basis for validating the final delivered system. Any changes
made to the requirements in the future will have to go through a formal change approve process.
The developer is responsible for asking clarifications, where necessary, and will not make any
alterations without the permission of the client.
- Change password
\ Administrator: has the overall control of the system. He/she can modify the structure of
[the system.
^Registered User: the one who familiar with the system and he/she has their own Login Id and
Password.
The system should run on windows 2000 onwards any operating system.
If the user is valid, that is he/she has registered with the system and has logged on
with a user name and password that is present in the database of the Inter mediate server, and
a positive response is initiated by the inter mediate server then the user can enter in to client
module.
The Add/Remove server option available to the administrator of the system, to I add a
new server and remove the existing one.
A table named serverdetails, ip, cpuusage, created in the database that takes care of
what ever data is to be manipulating use this interface.
The Add/Remove client option available to the administrator of the system, to I add a
new client and remove the existing one.
A table named ip, clientdetails, created in the database of the inter mediate server takes
care of what ever data is to be handled using this interface.
Using the Download/Upload interface in the client side a registered user can
download or upload files to or from a least loaded server. 13.1.2.6 Logoff
Using this option a registered user can signup from the system. I 3.2 Functional
Requirements
1. Registered User Login:
(a) User submit id and password
(b) If he/she has a valid id and password the user can enter in to product list.
2. If the registered is entering a fault password give provision to re enter the id
I and password.
3.3 Performance Constraints
In order to utilize the Network Load Manager features, need three machines tunning
Windows 2000 or higher. Each machine needs to have at least one network card and at least one
fixed IP address.
In addition you will also need one more machine for testing (4 machines | total).
The test machine should be external can't use a machine from the pool to test.
The application is developed by using J2EE, XML, JavaSwing, Apache TomCat 15.0
web browser,RMI-IIOP, SQLServer2000 database and is well functioned under any [ operating
system.
Pentium 4.28GHz
256 MB RAM
40 or 80 GB hard disk
Standard 101 Keyboard
Standard 2 button mouse
Backup: CD ROM/Hard Disk/Zip...
3.5 Security
Security come prime importance in public interface software. The :
Administrator mode is completely secure from the operational mode. The Administrator is asked
for proper authentication before entering a registered user into the system. The user can't make
changes to the database's critical data area.
3.6 Maintainability
The Database has to be constantly updated according to the changes coming
in System administrator should keep proper check to the changing needs of the user and there
by making appropriate changes to the database.
Before accepting the system, the developer must demonstrate that the system works
properly. The developer will have to show through test cases that all conditions are satisfied.
DESIGN DOCUMENT
1. INTRODUCTION
1.1 Purpose
The purpose of this document is to describe external and internal interface of this
fcystem. It explains in details about various modules incorporated in the project, using FER
diagrams, relational database Tables, form representations and DFDs.lt gives a representation of
external out look of the project.
1.2 Scope
The System Design Document describes how to transform the requirements and the
functional design into more technical system design specifications. Definitions and acronyms
DFD: - The Data Flow Diagram is a graphical representation that depicts ^information flow and the
transforms that are applied as data move from input to output. It [ aims to capture the
transformations that take place with in a system to the input data so that eventually the output
data is produced. DFDs are very useful in understanding a ^system and can be effectively used
during analysis.
[ 2 MODULE DECOMPOSITION
The entire project is divided in to two different modules. Administrative and user
module.
Administrative module: this module provides the administrator login, which have options
for the effective administrative tasks. They are:
Add/Remove server
Add/Remove client
Download Allocation
Change password
Generating reports
Help
User module: this module provides the user login, which have options for the effective
user operations. They are:
Messaging
Downloading/Uploading
Change password Help Logoff
3. DATA DECOMPOSITION
Login: this table is used to keep the username, password and permission type of the
user.
Serverdetails: this table is used to keep the details of the servers connected to the inter
mediate server.
Clientdetails: this table is used to keep the client details such as computername, logintime,
logindate, loginid etc.
ip: this table is used to keep the details of all nodes connected to the inter mediate server both
clients and servers. Computername, ipaddress and systemtype is stored to
this table.
Userdetails: this table is used to keep the user details such as loginid, username, address,
phone, email etc.
Userstatus: this table is used to keep the user details such as loginid, status, computername.
4. DEPENDENCY DESCRIPTION
It gives in detail about the different modules on which this project is dependent. DFD
used to show the flow of data between various components of the modules, which gives an idea of
how the entire project implements.
iLevel 0:
CLIENT
SERVER
: Level 1:
Level 2;Login
Level 3: IP Tracking
project Report - June 2006 Network Load Manager
Level 5:Download/Upload
Client details
Project Report - June 2006 Network Load Manager
Level6:Traffic Redirector
Server
1
Sendin
g
Reque
st
Processing
client
request /
CPU
usage
Comparin
g CPU
usage
Findin
g
least
loaded
server
Sendin
g
Reques
t
Server
2
Server
n
Level 7:Messaqing
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Field Name Type
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
loginid varchar[50]
Password varchar[50]
usertype varchar[50]
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
[Userdetails:
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Field Name Type
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
loginid varchar[50]
username varchar[50]
Address varchar[50]
Email varchar[50]
Phone varchar[50]
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Userstatus:
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Field Name Tvpe
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
loginid status varchar[50]
computername varchar[50]
varchar[50]
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Clientdetails:
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Field Name Tvpe
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
computername varchar[50]
logintime varchar[50]
logindate loginid varchar[50]
varchar[50]
CD
Wept of Comp Science & Engg SNG College of Engg, Kolenchery
Project Report - June 2006 Network Load Manager
Serverdetails:
computername varchar[50]
ostype varchar[50]
osversion varchar[50]
fcpuusage:
computername varchar[50]
usage varchar[50]
varchar[50]
id
logout:
Type
Field Name
varchar[50]
computername
varchar[50]
loginid
varchar[50]
logouttime
[6.Form Design
Login :
LOGIN
User Type
User name
Password
Administrator:
Administrator
Add Client
Remove Client.
Download allocation
Change Password
Exit
User:
User-
Service Hefc
Change .
Password
Exit
[Add Server:
New
Server
Add Cancel
Change Password:
Change Password
Remove Server:
Remove Server
Server Name 32
IP Address
Remove Cancel
Add Client:
New
Client/System
ComnuterName
IP Address
Add Cancel
User Information:
User Information
User Name |
Login id [ Add
Password
Cancel
[
Re-type password [
Address
Phone L~
E-mail
iRemove Client:
Remove Client/System
Computer Name IP
Address
Remove Cancel
CPU Usage:
Messaging:
Messaging
Send Cancel
Server Report
Server Report
Server IP Address CPU Usage
....
[Client Report
Client Report
■
Administrator
administrator Syste
m
Client Activities
OA
lrajuuc ^W-
- ^edirector-^ Agent Soft
8. Sequence Diagrams:
Login
4: calls login.java
6:userid not
7:userid, password not found
found
8:invalid login,Iogin again
Messaging
Traffic Least
A
redirector loaded
Client : class server :c Database
cp>r\H mpcc g lass
il Send message ;
2^-heck for leasy loaded server
^redirection
4lshow messagg
Download/Upload
TrafficLeastredirectorloade Check:
/ d: classserverxlass: class
svsinfo
Client Browser, usermenuuserrrtenu
jsp
,1 download 2 download
■ /upload ! /upload'^
4!redirectio!
n
5 download/
6:retum upload files
7:return to
user options
9. INTERFACE DESCRIPTION
The modules of this project are: ;
9.1 Add/Remove Server
A table named serverdetails, ip, and cpuusage, created in the database that I. takes
care of what ever data is to be manipulating use this interface.
The Add/Remove client option available to the administrator of the system, to ; add a
new client and remove the existing one.
A table named ip, clientdetails, created in the database of the inter mediate server takes
care of what ever data is to be handled using this interface.
The Download Allocation option for the administrator can allocate files to I download.
9.4 Messaging
Using Messaging option in the client side, a registered user can send unicast | message
to all the servers connected.
9.5 Download/Upload
Using the Download/Upload interface in the client side a registered user can
download or upload files to or from a least loaded server.
9.6 Logoff
Using this option a registered user can signup from the system.
1. TESTING
System testing is the stage of implementation, which is aimed at ensuring that [the
system works accurately and efficiently as expected before live operation commences. m certifies
that the whole set of programs hang together. System testing requires a test plan that consists of
several keys, activities and steps for running a program. The [implementation of newly designed
package is important in adopting a successful new ■system.
Software Testing is the critical element of software quality assurance and . represents
the ultimate review of specification, design and coding. This process is so important that nearly
40% of the total cost incurred in project effort is on testing.
-A good test case is one that has a high probability of finding an undiscovered error.
The system is tested via white box and black box testing approaches for logical [errors,
typographical errors, interface errors etc. Each module is tested in different [phases. Validation is
done in different modules. And the whole system is tested by using [minimal of four systems as
two servers, intermediate server and one client and the system worked properly.
2. IMPLEMENTATION
Implementations is the process of having systems personnel check out and put [the new
equipment in to use, train the users to use the new systems. We test the performance of the new
system for a period of time. In the testing period we can correct and update the project again.
Implementation is the stage of a project when the [theoretical design is turned into a working
system. If the implementation stage is not [carefully planned and controlled, it can cause chaos.
The implementation stage is a systems project in its own. Implementation is the stage of the
project where the theoretical [design turns into a working system. Thus it can be considered to be
the most crucial [stage in achieving a successful new and giving the users confidence that the
new system [will work and be effective and accurate. It is less creative than system design. It is
primarily [concerned with user training and site preparation.
Depending on the nature of the system, extensive user training may be required.
Implementation simply means converting a new system design into operation. An important
aspect of the system analyst's job is to make sure that the new design is implemented to establish
standards. Implementation means the process of converting a new raised system design into an
operational one.
SCREEN SHOTS
^CPU Usage
User Menu
I >MMil I. t i r|| | « i „ |
1 « u i if...
Send Message
Report-Client Status
Sen
d
Wroject Report - June 2006 Network Load Manager
CONCLUSION
CONCLUSION
Finally the system NETWORK LOAD MANAGER is ready to delivered for the client.
But still only a significant part of the application has been finished but still lot more extensions are
yet to get completed but that will require a lot of time.
The use of CPU load for the purpose of load balancing is a very attractive prospect.
Load balancing is an important way to maximize network efficiency.
APPENDIX
APPENDIX 1
Dept of Comp
CD
SNG College of Engg, Kolenchery
Science &
Project Report - June 2006 _ Network Load Manager
Abbreviations
V.
Definitions
SQL-The structured query language, SQL is a query language, which is used with relational
databases. A query is a statement requesting the retrieval of information. The portion of a
[ DML that involves information retrieval is called a query language. SQL uses a combination
f of relational algebra and relational-calculus constructs.
SRS- Important purpose of the process of developing an SRS is helping the clients to understand
their own needs. It helps in reducing the development cost.
I DDD-lt is an important document for developing the designs, i.e. tables E-R diagrams, data flow
diagrams.
J2EE
J2EE is a very effective concept used to build large scale components. It is an updated
version of Java. The Java Community Programs (JCP) formed it. Today, more and more
developers want to write distributed transactional applications for the enterprise and thereby
leverage the speed, security, and reliability of server-side technology. To reduce costs and fast-
track application design and development, the Java 2 Platform, Enterprise Edition (J2EE) offers a
muttered distributed application model, reusable components, a unified security model, flexible
transaction control.
RMI
A J2EE application and its components can invoke objects located on a different ^JVM by using
the Java Remote Method Invocation (RMI) system. RMI is used for remote ^communication
between Java applications and components, both of which must be written in Java programming
language. RMI is used to connect together a client and a server. A client is an application or
component that requires the services of an object to fulfill a \request. A server creates an
CD
SNG College of Engg, Kolenchery
Project Report - June 2006 _ Network Load Manager
application or component that requires the services of an object available to the clients. A client
contacts the server to reference and invoke the object using RMI.
CD
SNG College of Engg, Kolenchery
Project Report - June 2006 Network Load Manager
APPENDIX II
Sample codes:
Login. Java
btreg.setVisible(false);
txtusername.requestFocusO;
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:NLM","sa","sa");
stmt=con.createStatement(); } catch(Exception err){
//System.out.Println("SL Error"+err);
}
/** This method is called from within the constructor to
<2>
Dept of Comp Science & Engg SNG College of Engg, Kolenchery
Project Report - June 2006 Network Load Manager
}
});
jLabeH.setFont(newJava.awt.Font("MS Sans Serif", 1, 11));
jLabel1.setForeground(newjava.awt.Color(0, 51, 204)); jLabeM
.setText("User Name"); getContentPane().add(jLabel1);
jLabel1.setBounds(530, 320, 90, 30);
getContentPane().add(txtusername); txtusername.setBounds(630,
330,130, 20); jLabel2.setFont(newjava.awt.Font("MS Sans Serif, 1, 11));
jLabel2.setForeground(newjava.awt.Color(0, 51, 204));
jLabel2.setText("Password"); getContentPane().add(jLabel2);
jLabel2.setBounds(530, 370, 60, 20);
}
});
getContentPane().add(btcancel);
btcancel.setBounds(660, 420, 80, 30);
btlogin.setText("Login");
btlogin.setPreferredSize(newjava.awt.Dimension(80, 50));
btlogin.addActionListener(newjava.awt.event.Actionl_istener() { public
void actionPerformed(java.awt.event.ActionEvent evt)
{ btloginActionPerformed(evt);
}
});
btlogin.addMouseListener(newjava.awt.event.MouseAdapter(){ public
void mouseClicked(java.awt.event.MouseEvent evt)
{ btloginMouseClicked(evt);
}
»;
<2>
Dept of Comp Science & Engg SNG College of Engg, Kolenchery
Project Report - June 2006 Network Load Manager
}
});
getContentPane().add(btreg);
btreg.setBounds(530, 480, 210, 23); pack();
}//GEN-END:initComponents
private void btregActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
event_btregActionPerformed
// TODO add your handling code here:
Userinfo ui=new Userinfo();
ui.setVisible(true); }//GEN-
l_AST:event_btregActionPerformed
private void cmbusertypeActionPerformed(java.awt.event.ActionEvent evt) {// GEN-
FIRST:event_cmbusertypeActionPerformed // TODO add your handling code here: String
s=(String)cmbusertype.getSelectedltem(); if(s.equals("User"))
{
btreg.setVisible(true);
}
else{
btreg.setVisible(false);
}
}//GEN-l_AST:event_cmbusertypeActionPerformed
private void btcancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-
FIRST:event_btcancellvlouseClicked
Dept of Comp Science & Engg
<2>
Dept of Comp Science & Engg SNG College of Engg, Kolenchery
Project Report - June 2006 Network Load Manager
dispose();
}//GEN-LAST:event_btcancelMouseClicked
private void btloginMouseClicked(java.awt.event.MouseEvent evt) {//GEN-
FIRST:event_btloginMouseClicked
// TODO add your handling code here:
String usertype=(String)cmbusertype.getSelectedltem();
String username=txtusername.getText();
String password=txtpassword.getText();
MenuAdmin ob=new MenuAdmin();
usermenu ob1=new usermenu();
if((username.equals(" "))||(password.equals("")))
\ {
}
String uname-'select * from login where loginid="'+username+"'and
password="'+password+"'and usertype="'+usertype+"'"; try{
rs=stmt.executeQuery(uname);
if(rs.next())
\ {
}
return;
I
JOptionPane.showMessageDialog(null,"Login Successfully","Login
lnformation",JOptionPane.lNFORMATION_MESSAGE);
dispose();
obl.setVisible(true);
SimpleDateFormat dd=new SimpleDateFormat("MM/dd/yyyy");
String s=dd.format(d);
System.out.println(s);
SimpleDateFormat tt=new SimpleDateFormat("hh:mm:ss");
String s1=tt.format(t);
System.out.println(s1);
InetAddress in=lnetAddress.getLocalHost();
String IP=in.getHostAddress();
String hname=in.getHostName();
Project Report - June 2006 Network Load Manager
System.out.println(IP);
String sqlip="select computername from ip where ipaddress='"+IP+"'"; String
sqlu="select loginid from userstatus where loginid='"+name+"'";
rs=stmt.executeQuery(sqlu);
if(rs.next()) {String sql2="update userstatus set status-
Logon',computername="'+hname+'" where loginid='"+name+'"";
stmt.executeUpdate(sql2);
}
else{ String sqluserstatus="insert into userstatus
"+"(loginid,status,computemame)"+"Values("'+name+"','Logon',"'+hname+"')";
stmt.executeUpdate(sqluserstatus);
}
//String sqluser="select username from userdetails,login where
login.loginid-"+username+"' and login.loginid=userdetails.loginid";
rs=stmt.executeQuery(sqlip);
// stmt.executeUpdate(sql2);
//rs=stmt.executeQuery(sqluser);
if(rs.nextQ)
{
String cmp=rs.getString("computername"); //
String u=rs.getString("username");
String sql="insert into clientdetails
V'(computemamejoginumejogindate,^
stmt.executeUpdate(sql);}
}
else{
JOptionPane.showMessageDialog(null,"Invalid Login—Try Again");
txtusername.setText(""); txtpassword.setText(""); txtusername.requestFocus();
return;
} "
}
catch(Exception e)
{ System.out.println(e); }
//if(utype==) }//GEN-
LAST:event_btloginMouseClicked
private void btloginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_btloginActionPerformed
// TODO add your handling code here: }//GEN-
LAST:event_btloginActionPerformed /** Exit the
Application */
}
//Variables declaration - do not modify//GEN-BEGIN:variables
Messinter.iava
import Java.rmi.*;
importjava.net.*;
import Java, io.*;
}
Messserver.java import Java,
rmi.*; import Java.rmi.server.*;
import Java.io.*; import Java.awt.*;
import Java.awt.event.*; import
Java, util.*; import javax.swing.*;
import javax.swing.border.*; import
javax.swing.event.*;
public class messserver extends UnicastRemoteObject implements
messinter,ActionListener
{
super();
}
public void sendmess(String addr.String mess) {
String address=addr; String
message=mess; f=new
JFrame(); f,setTitle("
Message");
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); p1=new
JPanel();
p1 .setBackground(new Color(205,205,205)); p1 .setBorder(new
LineBorder(new Color(205,205,205),6)); pl.setLayout(null); p2=new
JPanel(); p2.setBackground(new Color(205,205,205));
p2.setBorder(new LineBorder(new Color(205,205,205),2));
p2.setLayout(null);
11 =newJLabel("INSTANT MESSAGE"); H.setFont(new Font("Times
New Roman",Font.BOLD,18)); 11.setForeground(newColor(163,28,28));
11 .setBounds(80,0,400,50); p1.add(H); /* I2=new JLabelfMessage
Details"); l2.setForeground(new Color(255,255,255)); !2.setFont(new
Font("Times New Roman",Font.BOLD,16));
l2.setBounds(90,0,125,20);
p2.add(l2);
4=new JLabel("Client Name");
l4.setForeground(newColor(255,255,255));
l4.setFont(new Font("Times New Roman",Font.BOLD,14));
l4.setBounds(110,25,150,20);
p2.add(l4);*/H6=new JLabel(" Message");
l6.setForeground(new Color(10,100,200));
l6.setFont(new Font("Times New Roman",Font.BOLD,12));
l6.setBounds(20,140,200,20);
p1 .add(l6);*/ ta=new JTextArea();
ta.setLineWrap(true);
ta. setWrapStyleWord (true);
ta.setFont(new Font("Times New Roman",Font.PLAIN,16));
ta.setForeground(new Color(0,0,255));
scroll.setBorder(new LineBorder(new Color(100,100,100),2));
scroll.setBounds(20,80,300,105);
scroll.getViewport().add(ta);
pl.add(scroll);
/* reply=new JButton("Reply"); reply.setBackground(new
Color(150,150,200)); reply.setForeground(new Color(155,255,255));
reply.setFont(new Font("Times New Roman",Font.BOLD,16));
reply.setBounds(60,305,80,30); . reply.addActionListener(this);
pl.add(reply);*/ close=new JButton("Close");
close.setBackground(new Color(150,150,200));
close.setForeground(new Color(155,255,255)); close.setFont(new
Font("Times New Roman",Font.BOLD,16));
close.setBounds(130,205,80,30); close.addActionListener(this);
pl.add(close);
Icon icon=new lmagelcon("menu.gif);
CD
SNG College of Engg, Kolenchery
Project Report - June 2006 Network Load Manager
}
public void actionPerformed(ActionEvent ae) {
if(ae.getSource()==reply) {
new sendmess();
}
if(ae.getSource()==close) {
f.dispose();
}
}
public static void main(String args[])
{
try {
messserver ms=new messserver();
Naming.rebind("messserver",ms);
}
catch(Exception e){}
Project Report - June 2006____________________________________________ Network Load Manager
}
} m
Sendmess.java
{
Connection con;
Statement stmt;
ResultSet rs,rs1,rs2;
Java.util.Date t=new Java.util.Date();
private JPanel p1,p2;
private JLabel 11,12,15,16;
//private JComboBox cbgname,cbcname;
//private ButtonGroup bg;
//private JRadioButton single,groups,all;
private JScrollPane scroll;
private JTextArea ta;
private JTextField tf;
private JButton send,cancel;
public sendmess() {
setTitle("Send Messages");
getContentPane().setLayout(null);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setBackground(newColor(205,205,205));
p1=new JPanel();
p1 .setBackground(new Color(205,205,205));
p1 .setBorder(new LineBorder(new Color(208,208,208),4));
p1 .setLayout(null);
p1.setBounds(1,1,472,441);
p2=new JPanel();
p2.setBackground(new Color(205,205,205));
//p2.setBorder(new LineBorder(new Color(100,100,100),3));
p2.setl_ayout(null);
p2.setBounds(200,50,250,160);
11 =newJLabel("MESSAGE SENDING");
11 .setFont(new Font("Times New Roman",Font.BOLD,20));
11 .setForeground(new Color(163,28,28));
11 .setBounds(140,10,200,30);
p1.add(M);
* I5=new JLabel("Client Name");
l5.setFont(new Font("Times New Roman",Font.BOLD,12));
l5.setForeground(new Color(0,0,0)); l5.setBounds(20,75,100,20);
p2.add(l5);*/
send.setBounds(125,280,80,30);
pl.add(send);
send.addActionListener(this); Icon icon=new
lmagelcon("menu.gif); JLabel image=new
JLabel(icon); image, setlcon(icon);
image.setBounds(0,0,480,450);
pl.add(image); getContentPane().add(p1);
setLocation(30,30); setResizable(false);
setSize(480,400); setVisible(true); try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:NLM","sa","sa");
stmt=con. createStatement();
} catch(Exception err){
//System.out.Printlnf'SL Error"+err);
}
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==send)
{
try{
String sql2="select computername from cpuusage order by usage"; rs1
=stmt.executeQuery(sql2); if(rs1.next()) {
String cmp=rs1 .getString(l); //
String cmp=rs.getString(0); //
System.out.println(cmp);
{
String ip=rs2.getString("ipaddress");
JOptionPane.showMessageDialog(null,"Server "+ip+" is Least Loaded...");
String message=ta.getText();
messinter in=(messinter)Naming.lookup("rmi://"+ip+7messserver");
in.sendmess(ip,message); // System.out.println(message); }
}
}catch(Exception e){
Status",JOptionPane.ERROR_MESSAGE); }
}
else if(ae.getSource()==cancel)
this.dispose();
REFERENCES
-A.Korth, HF, &Sudarshan, S., 1998 Database management systems, 3rd ed,
McGraw-Hill, NewYork, 560p
- Jim Keogh, The complete Reference J2EE Tata McGraw-hill edition ,886p