由於某些原因,我必須在等待與計算機連接的android SocketServer上進行設置。一切都很順利,套接字與客戶端(電腦)正在創建,但流無法打開。這只是暫停,沒有任何錯誤或消息。無法打開輸出流
客戶端:
s = new Socket(ip, 4567);
ois = new ObjectInputStream(s.getInputStream());
System.out.println("ois..");// not showing, so can't open input stream
oos = new ObjectOutputStream(s.getOutputStream());
System.out.println("oos.."); // same here
服務器:
socket = new ServerSocket(4567);
System.out.println("Waiting for connection,,"); // showing
client = socket.accept();
System.out.println("Connected"); //showing
ois = new ObjectInputStream(client.getInputStream());
System.out.println("ois.."); // not showing
oos = new ObjectOutputStream(client.getOutputStream());
System.out.println("oos.."); // not showing too
System.out.println("Stream,s opened");
我的APK具有Internet premissions。我正在使用4567端口。任何其他應用程序不會阻塞端口。
什麼可能是錯的?
什麼是錯誤??? – MAC 2012-04-26 18:32:29
向我們展示一些代碼。 – 2012-04-26 18:33:29