mirror of
http://galexander.org/git/simplesshd.git
synced 2025-01-03 19:50:55 +00:00
if there are multiple interfaces up, go ahead and list them all
This commit is contained in:
parent
698ce0c52c
commit
fc20a31b6c
@ -8,9 +8,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:typeface="monospace"
|
||||
android:singleLine="true"
|
||||
android:background="#ff112266"
|
||||
android:scrollHorizontally="true"
|
||||
android:text="IP: XXX" />
|
||||
<EditText android:id="@+id/log"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -47,7 +47,7 @@ public class SimpleSSHD extends Activity
|
||||
update_startstop_prime();
|
||||
updater = new UpdaterThread();
|
||||
updater.start();
|
||||
ip_view.setText("IP: "+get_ip());
|
||||
ip_view.setText(get_ip());
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
@ -166,6 +166,7 @@ public class SimpleSSHD extends Activity
|
||||
}
|
||||
|
||||
public static String get_ip() {
|
||||
String ret = "";
|
||||
try {
|
||||
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
|
||||
for (NetworkInterface intf : interfaces) {
|
||||
@ -178,11 +179,14 @@ public class SimpleSSHD extends Activity
|
||||
if (i != -1) {
|
||||
ip = ip.substring(0,i);
|
||||
}
|
||||
return ip;
|
||||
if (!ret.equals("")) {
|
||||
ret += "\n";
|
||||
}
|
||||
ret += "IP: "+ ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) { } // for now eat exceptions
|
||||
return "";
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user