通过不断连接服务器的各个端口来测试哪个端口已经打开:
1.new android project:PortsScan
2.修改activity_main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<Button android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="@string/initScan" android:id="@+id/startScan"/>
<TextView
android:id="@+id/tvPorts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/prompt" />
</LinearLayout>
3.实现MainActivity.java
package cn.yh.portsscan;
im