Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jan 15th, 2007, 9:19 AM   #1
fresher
Newbie
 
Join Date: Dec 2006
Posts: 13
Rep Power: 0 fresher is on a distinguished road
network monitoring program

Hi all, is anyone able to help me out with this great task in java pls? I have tried my best but have just hit the brick wall. any responses greatly appreciated.

Below is the specification ( couldnt attach it unfortunately)


NETWORK MONITORING PROGRAM

The aim of this project is to create a network monitoring utility that will enable a network engineer / technician to inspect machines on his / her network and check for good operation. You will need to design and implement two programs.

1. The main utility.
2. The client program.

Main utility program.
This program must have a User Graphic Interface, that presents all computers currently attached on the network and allow the user to select and view information about a particular one if he/she so wishes. Also computers on the network should come up with a different icon or colour if there is a particular problem associated with them by the user
of the utility. The main core function of the utility is to communicate with the client program in regular intervals and check for good operation. If the communication cannot be established or the client takes too long to answer or it sends back a predefined message of trouble then the user can identify that this particular machine is problematic. 
`------
The client utility’s function is to run in all computers on the network and periodically report back (or upon request) to the main utility computer the status of its operation. The client utility may contain information about the user of the terminal at that particular
moment or simply report back in a set amount of time, indicating otherwise that there is a problem. This utility does not need to have a user interface, it may require however a settings interface if you so wish.

I’m assessed based on the following:

• Graphics Interface
• Networking 
• Use of objects, Methods, good understanding of java basics 
o Solid use of Java
o Object Oriented Programming principles
o Proper identification of variables
o Flow diagrams
o Simplicity
o Functionality
A FEW HELPFUL TIPS:
• Remember to use Java’s coding conventions.
• Write well-structured and readable code with appropriate comments in the right
places.

hints and tips:
• Keep the fundamentals of Object Orientation in mind when you write your code i.e. reuse objects, don’t write unnecessarily long programs if you can split the work into different classes, try and use constructors to initialize your programs and don’t burden your main class with variable assignments, etc.
• Finally, write small pieces of code and compile them and add functionality to it. It would help, NOT to write your whole program together and then try and compile it and sort out your 1000 or so odd errors yourself while the supervisors are busy looking at someone else’s 2000 odd errors!!!

------------this is my attempt before hitting the brick wall
SERVER
//***************************
/*
*
*program description
*author etc
*
*/
//*******************************

// TCP server which sends a message to client - non threaded
import java.io.*;
import java.util.*;
import java.net.*;


public class TCPserverText
{
public static void main(String args[])
{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        
        // port to receive TCP connections
        int receivePort=9000;             
         Socket socket=null;
            try
                {
                  System.out.println("TCP server starting...: IP address "
                       + InetAddress.getLocalHost().toString() + " port " + receivePort );
                       
                  ServerSocket serverSocket = new ServerSocket(receivePort);
                  
                  // Wait for client to connect.
                  socket = serverSocket.accept();                  
                  System.out.println("Client connection detected from IP address " + socket.getInetAddress()
                                  + " port " + socket.getPort());
                                  
                  // open writer to the client and  send  a message
                  PrintWriter pw = new PrintWriter(socket.getOutputStream());
                  pw.println("Hello " + socket.getInetAddress() + " on port " + socket.getPort());
                  //System.out.println("enter text to send to client");
                  // loop sending messages to client
                  while(true)                       
                    try
                      {
                       pw.flush();
                       String line = in.readLine();
                       pw.println(line);
                     }
                    catch (Exception se) {System.err.println("closing connection"); break;}
                  pw.close();
                  serverSocket.close();
                }
                
                
            catch (Exception se) {System.err.println( se); }
        }
}

CLIENT
------
// TCP client which receives a message from  server

import java.io.*;
import java.util.*;
import java.net.*;


	class IPgenerator2
	{
  		String view_host;
  		String accept;
  		int choice;
		String ip = "148.197.67.";
	
		String ipmethd()
		{
	
	
		KeyboardInput in = new KeyboardInput();
	
		for(int i = 1; i < 10; i++) {
		System.out.print(i);
		System.out.print(". ");
		//System.out.print();
		System.out.println(ip + i);
		}
		System.out.println();
		
		//enter a different network id or hit enter to continue
		//to allow user to enter a different netwrok portion
		//hitting enter implies network is same
			
		//System.out.print("Enter your network part or press enter to proceed: ");
			//String network = in.readString();
			
			//test
			//.out.println(network);
			
			//if enter is pressed - same network
		  //	if("".equals(network))
			//{
			
				System.out.print("SELECT A MACHINE TO VIEW FROM LIST: ");
				int choice = in.readInteger();
				
					
				
			//	}
			//	else
			
				//pass new network part to ip string variable
			//	ip = network;
				
		
		
		
				//real switch 
				switch (choice)
  		 		{ 
 		
 				case 1:
 				view_host = "148.197.67.211";
 				//System.out.println("You selected to view machine with IP: " + view_host);
 				//return view_host = "192.168.2.1"; 
 				break;
 	
 				case 2:
 				view_host = "148.197.67.212";
 				//System.out.println("You selected to view machine with IP: " +  view_host);
 				//return view_host = "192.168.2.2";
 				break;
 			
 				case 3:
 				view_host = "148.197.67.213";
 				//System.out.println("You selected to view machine with IP: " +  view_host);
 				//return view_host = "192.168.2.3";
 				break;
 			
 				case 4:
 				view_host = "148.197.67.214";
 				//System.out.println("You selected to view machine with IP: " +  view_host);
 				//return view_host = "192.168.2.4";
 				break;
 			
 				case 5:
 				view_host = "148.197.67.215";
 				//System.out.println("You selected to view machine with IP: " +  view_host);
 				//return view_host = "192.168.2.4";
 				break;
 			
 				case 6:
 				view_host = "148.197.67.216";
 				//System.out.println("You selected to view machine with IP: " +  view_host);
 				//return view_host = "192.168.2.4";
 				break;
 			
 	
 				default:
 				System.out.println("This machine doesnt exist, please choose a valid host");
 			
 				//return view_host;
 				}
 				
 		 	return view_host; 
 		 
	 	    }
 	  }




	//client program starts here

	public class TCPclientText
	{
	
			public static void main(String args[])
			{
			//initialisation
			String view_host; 
			IPgenerator2 ip = new IPgenerator2();
			
			//call ipgenerator
			//ip.ipmethd();
	
	   
			//server IP address
 		  	//String remoteIPaddress="192.168.2.4";
 		 	// int remotePort=9000;
  
  
  
			  //array to hold list of client IPs say registered
 			 //array enables me select the client to connect to
 			// String remoteIPaddress[]={"192.168.2.4","192.168.2.5","192.168.2.6"};
 			//call ip generator and assign it 
 			
  			String remoteIPaddress =ip.ipmethd();
   			int remotePort=9000;
   	
  			//for(int index=0; index<3;index++)
   
  			 try
       			{
        		// connect to server with remoteIPaddress on remotePort
        		//Socket socket1 = new Socket( remoteIPaddress, remotePort );
        		//here I have selected to connect to just the first client - index 0
        		Socket socket1 = new Socket( remoteIPaddress, remotePort );
        
        
        		//timeout after 3sec of inactivity
        		//socket1.setSoTimeout(3000);
        
        		// open reader to receive messages from server
        		BufferedReader inFromServer = new BufferedReader(new InputStreamReader( socket1.getInputStream()));
        		System.out.println("Server contacted OK ");
        
        
        		// loop reading messages from server
        		while(true)                
            	{
            	
            	String line = inFromServer.readLine();
            	System.out.println("From server " + line);
            	}  
              
         	}
        
        		catch(UnknownHostException e){
            	System.err.println("Don't know about host ....");    
            	}       
        
        	//predefined message is returned if server cannot be contacted
        	catch(ConnectException e){
            System.err.println("Unreachable node!, failure in connecting to server"); 
            }    
        
    	catch (IOException e) {System.err.println("TCP client error " +  e); }
    
    	//if server suddenly shutsdown for instance
    
         }
    }
It mustnt be with the GUI. coding that works will be very helpful indeed.

many thanks for responses in advance pls im stuck...

Last edited by fresher; Jan 15th, 2007 at 9:49 AM.
fresher is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Language display in program Prm753 C++ 3 May 30th, 2006 5:45 PM
Creating a program to test a program sixstringartist C 8 Jan 21st, 2006 1:15 PM
problem with network program Brent C++ 57 Aug 31st, 2005 12:57 PM
auto run hidden program. kuroko C++ 9 Aug 6th, 2005 10:05 AM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:45 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC