I have another problem that i also write code for get the IP Address and the result is 127.0.0.1 T_T seem like it take the IP Address from local loop back, so i can't get MAC Address too. Could anyone help how to get eth0 instead of lo.
analyze@ubuntu:~/Desktop$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:16
3:A4:F6:79
inet addr:192.168.1.33 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::216:d3ff:fea4:f679/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:499 errors:0 dropped:0 overruns:0 frame:0
TX packets:416 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:229934 (224.5 KiB) TX bytes:61790 (60.3 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:300 (300.0 b) TX bytes:300 (300.0 b)