small ip scanner code in java

0 votes
import java.net.*;
public class myIP {
public static void main (String argv[]) 
{ 
    try{
          InetAddress ownIP=InetAddress.getLocalHost();
          String myIP = ownIP.getHostAddress();
          System.out.println( "IP of my system is := "+ myIP );
        }catch (Exception e){
          System.out.println( "Exception caught ="+e.getMessage() );
        }
      }
}

This piece of code retrieves the machine's IP address. With this information (my own IP address), I'd want to search for other IP addresses in this range to automatically locate the server.

I'm at a loss as to how to iterate through this IP range. For example, if "myIP" is 10.0.0.5, how can I change that string to, say, 10.0.0.6? If it were an integer number, it would be simple to add 1 every time - but since it's a string - separated by dots - I'm stumped:) any suggestions?

Feb 15 in Cyber Security & Ethical Hacking by Edureka
• 5,760 points
13 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Cyber Security & Ethical Hacking

+1 vote
1 answer

How to find IP address of nodes in my network?

The IP address of the nodes connected ...READ MORE

answered Feb 9, 2019 in Cyber Security & Ethical Hacking by Omkar
• 69,190 points
1,177 views
0 votes
1 answer

how to find ip address in cmd

1. Open the Command Prompt.   a. Click the Start icon, ...READ MORE

answered Feb 9 in Cyber Security & Ethical Hacking by Edureka
• 5,760 points
33 views
0 votes
1 answer

Private IP Address Identifier in Regular Expression

I'm assuming you want to match these ...READ MORE

answered Feb 16 in Cyber Security & Ethical Hacking by Edureka
• 5,460 points
119 views
0 votes
1 answer

How do i check a ip address range whether it falls in Class A,Class B,Class C

class NetworkId{ static String findClass(String str){ int index = ...READ MORE

answered Feb 16 in Cyber Security & Ethical Hacking by Edureka
• 5,760 points
35 views
0 votes
1 answer

How can I change IP in Android emulator

Here's the six step you need to ...READ MORE

answered Feb 24 in Cyber Security & Ethical Hacking by Edureka
• 5,460 points
235 views
0 votes
1 answer

How to return client IP address in loopback 4?

You should also add this code in ...READ MORE

answered Mar 2 in Cyber Security & Ethical Hacking by Edureka
• 5,760 points
57 views
0 votes
2 answers

Finding local IP addresses using Python's stdlib

import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s ...READ MORE

answered Mar 30, 2020 in Python by anonymous
1,585 views
0 votes
0 answers
0 votes
0 answers

find IP address by domain in go

I am using below code for an ...READ MORE

Feb 16 in Cyber Security & Ethical Hacking by Edureka
• 5,460 points
21 views
0 votes
0 answers
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP