資源簡介
這是《Java TCP/IP Socket編程》一書的源代碼,有興趣的朋友可以看!

代碼片段和文件信息
import?java.util.Enumeration;
import?java.net.*;
public?class?InetAddressExample?{
??public?static?void?main(String[]?args)?{
????
????//?Get?the?network?interfaces?and?associated?addresses?for?this?host
????try?{
??????Enumeration?interfaceList?=?NetworkInterface.getNetworkInterfaces();
??????if?(interfaceList?==?null)?{
????????System.out.println(“--No?interfaces?found--“);
??????}?else?{
????????while?(interfaceList.hasMoreElements())?{
??????????NetworkInterface?iface?=?interfaceList.nextElement();
??????????System.out.println(“Interface?“?+?iface.getName()?+?“:“);
??????????Enumeration?addrList?=?iface.getInetAddresses();
??????????if?(!addrList.hasMoreElements())?{
????????????System.out.println(“\t(No?addresses?for?this?interface)“);
??????????}
??????????while?(addrList.hasMoreElements())?{
????????????InetAddress?address?=?addrList.nextElement();
????????????System.out.print(“\tAddress?“
????????????????+?((address?instanceof?Inet4Address???“(v4)“
????????????????????:?(address?instanceof?Inet6Address???“(v6)“?:?“(?)“))));
????????????System.out.println(“:?“?+?address.getHostAddress());
??????????}
????????}
??????}
????}?catch?(SocketException?se)?{
??????System.out.println(“Error?getting?network?interfaces:“?+?se.getMessage());
????}
????//?Get?name(s)/address(es)?of?hosts?given?on?command?line
????for?(String?host?:?args)?{
??????try?{
????????System.out.println(host?+?“:“);
????????InetAddress[]?addressList?=?InetAddress.getAllByName(host);
????????for?(InetAddress?address?:?addressList)?{
??????????System.out.println(“\t“?+?address.getHostName()?+?“/“?+?address.getHostAddress());
????????}
??????}?catch?(UnknownHostException?e)?{
????????System.out.println(“\tUnable?to?find?address?for?“?+?host);
??????}
????}
??}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-10-27?12:13??Java?TCP_IP?Socket編程源代碼\
?????目錄???????????0??2013-10-27?12:12??Java?TCP_IP?Socket編程源代碼\Chapter2\
?????文件????????1841??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter2\InetAddressExample.java
?????文件????????1628??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter2\TCPEchoClient.java
?????文件????????2706??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter2\TCPEchoClientGUI.java
?????文件????????1427??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter2\TCPEchoServer.java
?????文件????????2254??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter2\UDPEchoClientTimeout.java
?????文件????????1030??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter2\UDPEchoServer.java
?????目錄???????????0??2013-10-27?12:12??Java?TCP_IP?Socket編程源代碼\Chapter3\
?????文件????????2490??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter3\BruteForceCoding.java
?????文件????????1352??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter3\Delimfr
?????文件?????????195??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter3\fr
?????文件????????1262??2012-02-27?17:31??Java?TCP_IP?Socket編程源代碼\Chapter3\Lengthfr
?????文件????????1818??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteClientTCP.java
?????文件????????1796??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteClientUDP.java
?????文件????????2061??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteMsg.java
?????文件????????2988??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteMsgBinCoder.java
?????文件?????????171??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteMsgCoder.java
?????文件????????2356??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteMsgTextCoder.java
?????文件????????1416??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteServerTCP.java
?????文件????????1496??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteServerUDP.java
?????文件?????????726??2012-02-27?17:32??Java?TCP_IP?Socket編程源代碼\Chapter3\VoteService.java
?????目錄???????????0??2013-10-27?12:12??Java?TCP_IP?Socket編程源代碼\Chapter4\
?????文件????????2279??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\CompressClient.java
?????文件????????1615??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\CompressProtocol.java
?????文件????????1624??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\EchoProtocol.java
?????文件????????1062??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\FileClientap
?????文件????????1257??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\FileClientap
?????文件????????1042??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\TCPEchoServerExecutor.java
?????文件????????1360??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\TCPEchoServerPool.java
?????文件????????1031??2012-02-27?17:33??Java?TCP_IP?Socket編程源代碼\Chapter4\TCPEchoServerThread.java
............此處省略14個文件信息
- 上一篇:學生管理系統jsp mvc
- 下一篇:計算機專業畢業設計-外文翻譯
評論
共有 條評論