then the client can not connect in any case, it is certainly the
Code:
server = new ServerSocket (12345);
System.out.println ("ip:" + server.getLocalSocketAddress () + "---- port:" + server.getLocalPort ());
System.out.println ("Server ip:" + server.getInetAddress ());
System.out.println ("Server build successful ************");
In logcat in to be able to view the "Server build success" and all of the outputs are normal, but that is not really open ports
But if it is created directly in the Application Program ServerSocket object, then you can open the port, the client connection is also normal
seeking advice! ! !
Note:
manifest in the network permissions have been added
------ Solution ------------------------------------ --------
simulator on a port other than the port on a PC, two mapping needs to be done
mapped to the local port to the simulator TCP/7100 port TCP/6100 (UDP is the same).
> adb-s emulator-5554 forward tcp: 6100 tcp: 7100
------ reference ---------------- -----------------------
Oh, that how to write the code inside directly mapped convert it? Every case, it is not appropriate
------ reference ------------------------------- --------
look
------ reference --------------------------- ------------
------ reference ------------------------------------ ---
same problem, ah, a port on the computer to establish good, put it inside to create Android has been unable to visit. Now there is an expert to answer it?
------ reference --------------------------------------- < br>
I put the entire program installed on the phone, and then access the phone ip, does not run on the simulator. This is not acceptable, the same can not access the port.
------ reference --------------------------------------- < br> The IP phone is not public IP, if not a LAN or through other means, then establish a Socket connection is accessible reach.
------ reference --------------------------------------- < br>
I put the entire program installed on the phone, and then access the phone ip, does not run on the simulator. This is not acceptable, the same can not access the port.
phone's IP is not public IP, if not a local area network or by other means to establish a bridge Socket words are accessed invisible.
没有评论:
发表评论