-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathARPClient.java
33 lines (33 loc) · 935 Bytes
/
ARPClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.io.*;
import java.net.*;
public class ARPClient
{
public static void main(String args[])
{
String send_msg, recv_msg=" ";
try
{
InetAddress ip=InetAddress.getLocalHost();
Socket s=new Socket(ip, 9124);
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream dis=new DataInputStream(s.getInputStream());
DataInputStream d=new DataInputStream(System.in);
System.out.println("\n\t\t***Implementation of ARP***\n");
System.out.println("\nEnter the IP Address: ");
send_msg=d.readLine();
ps.println(send_msg);
recv_msg=dis.readLine();
if (!recv_msg.equals("-1"))
{
System.out.println("\nMAC Address of given IP Address: ");
System.out.println(recv_msg);
}
else
{
System.out.println("Host Not Found\n");
}
ps.close();
s.close();
}catch (Exception se) {System.out.println("Exception: "+se.getMessage());}
}
}