-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocket.java
More file actions
31 lines (26 loc) · 1 KB
/
socket.java
File metadata and controls
31 lines (26 loc) · 1 KB
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
package socket;
import java.io.IOException;
import java.net.InetAddress;
public class socket{
public static void main(String[] args) throws IOException{
InetAddress Inetaddress=InetAddress.getLocalHost();
System.out.println("InetAddress:"+Inetaddress);
System.out.println("getLocalhost£º"+Inetaddress.toString());
System.out.print("ByteÊä³ölocalhostgetAddress£º");
byte[] address=Inetaddress.getAddress();
for(byte a:address){
System.out.print(a);
}
System.out.println();
System.out.println("toStringÊä³ölocalhostgetAddress:"+Inetaddress.getAddress().toString());
InetAddress[] Inetaddress_server_array=InetAddress.getAllByName("time-A.timefreq.bldrdoc.gov");
for(InetAddress Inetaddress_server:Inetaddress_server_array){
//System.out.println("lalaal*******"+Inetaddress_server.getAddress().toString());
System.out.println("byteÊä³ö£º");
byte[] Inetaddress_server_byte=Inetaddress_server.getAddress();
for(byte a:Inetaddress_server_byte){
System.out.print(a);
}
}
}
}