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, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
412 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,220 points
4,922 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, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
47,517 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, 2022 in Cyber Security & Ethical Hacking by Edureka
• 12,690 points
3,350 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, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
894 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, 2022 in Cyber Security & Ethical Hacking by Edureka
• 12,690 points
9,676 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, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
1,135 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
3,072 views
0 votes
0 answers

Track the exact location of IP address

I looked into IP addresses and a ...READ MORE

Feb 14, 2022 in Cyber Security & Ethical Hacking by Edureka
• 13,620 points
871 views
0 votes
0 answers

find IP address by domain in go

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

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