ping program
my program will ping upto 192.168.100.59.
and i want to insert that particular inforamtion into my oracle db.and i want to update it in my network.
here my question is:my prog inserting only one ipadress into my db but i want every ip info into my db.so can u pls help me out.
code:
import java.io.*;
import java.sql.*;
import java.util.*;
public class nmap
{
public static void main(String[] args)
{
new nmap_thread("192.168.100").start();
/*new nmap_thread("192.168.110").start();
new nmap_thread("192.168.120").start();
new nmap_thread("192.168.130").start();
new nmap_thread("192.168.140").start();
new nmap_thread("192.168.150").start();
new nmap_thread("192.168.160").start();
new nmap_thread("192.168.180").start();*/
}
}
class nmap_thread extends Thread
{
Connection con=null;
PreparedStatement st=null;
public nmap_thread(String s)
{
super(s);
}
public void run()
{
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:oradsn","system","1212");
//st=con.createStatement();
}catch(Exception e){}
String s1=getName();
String ip_mac = "";
lp1:for(int i=50;i<60;i++)
{
ip_mac = s1+"."+i;
try
{
Process p = Runtime.getRuntime().exec("ping "+ip_mac,null);
BufferedReader br = new BufferedReader (new InputStreamReader(p.getInputStream()));
String line = null;
int flag =0;
while((line = br.readLine()) != null )
{
//output.write(line);
// System.out.println(line);
if((line.indexOf("Reply from")> -1) && (flag == 0))
{
/*st=con.prepareStatement("insert into sun1 values(?,'on')");
int k=st.executeUpdate();
st.setString(1,ip_mac);*/
//st.setString(2,'on');
System.out.println("System "+ip_mac+" up");
flag ++;
}
}
if(flag == 0)
{
System.out.println("System"+ip_mac+" down");
}
//output.close();
int exitVal = p.waitFor();
StringTokenizer str=new StringTokenizer(ip_mac);
String o1;
while(str.hasMoreTokens())
{
Object o=str.nextToken();
o1=o.toString();
}
st=con.prepareStatement("insert into sun1 values(?,'off')");
st.setString(1,o1);
//for (int i1 = 0; i1 < 10; i1++) {
//st.setInt(2, i1);
int rowCount = st.executeUpdate();
//i=0;
con.close();
}
catch(Exception e){}
}
}
}
View Answers
Related Tutorials/Questions & Answers:
ping programping program my
program will
ping upto 192.168.100.59.
and i want to insert that particular inforamtion into my oracle db.and i want to update...+"."+i;
try
{
Process p = Runtime.getRuntime().exec("
ping "+ip_mac
PingPing Hi,
I have installed DB2 to one of my system, I can't able to access the data from the Db2 server even I tried with its ip address but still cn't able to
ping to database.
Regards,
Anil
Advertisements
ModuleNotFoundError: No module named 'ping'ModuleNotFoundError: No module named '
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named '
ping'
How to remove the ModuleNotFoundError: No module named '
ping' error
ModuleNotFoundError: No module named 'aio_ping'ModuleNotFoundError: No module named 'aio_
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'aio_
ping'
How to remove the ModuleNotFoundError: No module named 'aio_
ping ModuleNotFoundError: No module named 'another_ping'ModuleNotFoundError: No module named 'another_
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'another_
ping'
How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'mass-ping'ModuleNotFoundError: No module named 'mass-
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'mass-
ping'
How to remove the ModuleNotFoundError: No module named 'mass
ModuleNotFoundError: No module named 'ping-cmd'ModuleNotFoundError: No module named '
ping-cmd' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named '
ping-cmd'
How to remove the ModuleNotFoundError: No module named '
ping-cmd
ModuleNotFoundError: No module named 'ping-me'ModuleNotFoundError: No module named '
ping-me' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named '
ping-me'
How to remove the ModuleNotFoundError: No module named '
ping-me
ModuleNotFoundError: No module named 'ping-pong'ModuleNotFoundError: No module named '
ping-pong' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named '
ping-pong'
How to remove the ModuleNotFoundError: No module named '
ping ModuleNotFoundError: No module named 'ping_sweep'ModuleNotFoundError: No module named '
ping_sweep' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named '
ping_sweep'
How to remove the ModuleNotFoundError: No module named '
ping ModuleNotFoundError: No module named 'procamora-ping'ModuleNotFoundError: No module named 'procamora-
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'procamora-
ping'
How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'python-ping'ModuleNotFoundError: No module named 'python-
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'python-
ping'
How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'python-ping'ModuleNotFoundError: No module named 'python-
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'python-
ping'
How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'tay-ping'ModuleNotFoundError: No module named 'tay-
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'tay-
ping'
How to remove the ModuleNotFoundError: No module named 'tay-
ping ModuleNotFoundError: No module named 'aio_ping'ModuleNotFoundError: No module named 'aio_
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'aio_
ping'
How to remove the ModuleNotFoundError: No module named 'aio_
ping ModuleNotFoundError: No module named 'another_ping'ModuleNotFoundError: No module named 'another_
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'another_
ping'
How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'django-ping'ModuleNotFoundError: No module named 'django-
ping' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'django-
ping'
How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'aws-ping-login'ModuleNotFoundError: No module named 'aws-
ping-login' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'aws-
ping-login'
How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'django-ping-me'ModuleNotFoundError: No module named 'django-
ping-me' Hi,
My Python
program is throwing following error:
ModuleNotFoundError: No module named 'django-
ping-me'
How to remove the ModuleNotFoundError: No module named
ping command in servletping command in servlet hi can we execute
ping command in servlet like as we do in normal java. if we can please give an example how.
thanks & regards
programprogram any
program of hotel or school management
programprogram
program of jdbc using ms access for creating table
programprogram write a javascript
program to create a application form with validation
programprogram write a html
program in show table and this word
in box
programprogram write a
program different between to dates in terms of days in java
programprogram WAP a java
program to form 1/2+3/4+5/6+7/8 series
programprogram Write a
program to find the difference between sum of the squares and the square of the sums of n numbers
programprogram write a
program reversee a string.
input-hi this is roseindia
output-roseindia is this hi
programprogram develop a servlet to insert the data in the database from our
program in the table stored in the database
programprogram An old-style movie theater has a simple profit
program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the
program calculateTotalProfit that consumes
programprogram write a java
program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
programprogram Develop the
program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
programprogram explanation of
program on extending thread class
Hi Friend,
Please go through the following link:ADS_TO_REPLACE_1
Java Threads
Thanks
programprogram Develop a
program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean
programprogram how to improve programming skills plss tell some tips..i am understanding concepts but unable to write
program so,pls give some guideness plsss
ProgramProgram a
program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = â??Tommyâ?? age=â??23â?? and call this constructor
ProgramProgram a
program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
programprogram no i want a
program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation... in rectangles or circles wat ever it may be. the theme of
program is to show algorithm
programprogram . Develop a
program that accepts an initial amount of money (called the principal), a simple annual interest rate, and a number of months will compute the balance at the end of that time. Assume that no additional
programprogram Write a JSP
Program, which displays a web page containing the name of the Courses, Courses being offered currently, number of students enrolled in each course, new courses to be offered, eligibility criteria for taking
programprogram i want a progra in java to print a sentence in alphabetic order, taking the input from the user.the
program should writen without using the array
for example : if input= this is a cat
then output sould = a cat
programprogram Utopias tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the
program calculateTax which determines the tax on the gross pay. Define
programprogram Write a JSP
Program, which displays a web page containing two web links one for your profiling and other for the schedule of theory of practical classes of your Batch. When one click on link for getting your profile
programprogram Write a
program to print details of a week for a particular day using array of objects Integer and String.
OUTPUT:
First Day of Week is Monday
Second Day of Week is Tuesday
Third Day of Week is Wednesday
Forth Day