0
我在應用程序 -建立的ServerSocket連接
public class BorderCastList extends Activity {
private VideoView video;
private ServerSocket server;
private MediaController media;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Settings window for translucent state
// this.getWindow().setFormat(PixelFormat.TRANSLUCENT);
this.setContentView(R.layout.video);
new Thread(new Runnable() {
@Override
public void run() {
try {
Log.i("test", "before info ServerSocket");
server = new ServerSocket(8050)
Log.i("test", "after info ServerSocket");
Log.i("ip:" + server.getLocalSocketAddress() + "----port: "
+ server.getLocalPort(), "");
Log.i("service ip: " + server.getInetAddress(), "");
Log.i("Server build success************", "");
// Socket socket = server.accept();
} catch (Exception e) {
Log.i("aaa", "bbbb");
e.printStackTrace();
}
}
}).start();
)
爲什麼會收到日誌輸出Log.i("test", "before info ServerSocket");
但不Log.i("test", "after info ServerSocket");
Log.i("ip:" + server.getLocalSocketAddress() + "----port: "+ server.getLocalPort(), "");
Log.i("server ip: " + server.getInetAddress(), "");
Log.i("Server build success************", "");
爲何不new ServerSocket(8050)
之後執行使用此代碼?