/* getIPx.java get ethernet ip address */
import java.net.*;
import java.util.*;
public class getIPx {
public static void main(String args[]) throws Exception {
String niname ;
InetAddress ia[] = null ;
String ip = null ;
NetworkInterface ni = null ;
Enumeration e = (Enumeration) ni.getNetworkInterfaces();
ni = (NetworkInterface) e.nextElement() ;
niname = (String) ni.getName();
if (niname!="eth0") {
ni = (NetworkInterface) e.nextElement() ;
niname = (String) ni.getName();
}
System.out.println(niname );
Enumeration e2 = (Enumeration) ni.getInetAddresses(); // get All ipaddresses
/*while (e2.hasMoreElements()) { // if more then one address need do loop
ia[0] = (InetAddress) e2.nextElement();
ip = ia[0].getHostAddress();
} */
System.out.println(e2.nextElement());
} //end of main
} // end of class
老夫個人雜記, 基於創用CC(Creative Commons)精神歡迎分享資料
Taiwan / Repulic of CHINA / ROC ( Traditional Chinese ).
2009-12-31
2009-12-29
Call Java from JavaScript
2009-12-28
My Home NAS 網路磁碟機
AirLink
Model: ANAS350 link
* Supports 3.5" IDE or SATA HDD
* 2 USB 2.0 hosts for extra storage
* 10/100 Fast Ethernet connection
* Easy setup for SMB / FTP Server
* Advanced FTP account management
Network Attached Storage(NAS)
Model: ANAS350 link
* Supports 3.5" IDE or SATA HDD
* 2 USB 2.0 hosts for extra storage
* 10/100 Fast Ethernet connection
* Easy setup for SMB / FTP Server
* Advanced FTP account management
Network Attached Storage(NAS)
2009-12-23
Tunnel software
MS Windows mapping network disk
讓 MS Windows 開機後無人登入前即執行 network disk mapping
這樣開機時就會執行mapping o: volume 磁碟機的動作囉.
example:
"c:\winnt\system32\net.exe" use o: \\xxnt01\ap$ password /USER:tpe\user01
- 執行:regedit
- 路徑:我的電腦\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
- 新增:字串值
- 名字隨便給
- 值 "c:\winnt\system32\net.exe" use o: \\ xxnt01\ap$ Password /USER:Account
- c:\winnt 為windows主目錄位址,請自行更改
- O -- 磁碟機代號
- \\xxnt01\ap$ -- 連線路徑
- Password -- 連線密碼
- Account -- 連線帳號, EX: tpe\user01
這樣開機時就會執行mapping o: volume 磁碟機的動作囉.
example:
"c:\winnt\system32\net.exe" use o: \\xxnt01\ap$ password /USER:tpe\user01
訂閱:
文章 (Atom)