I have an android device that is running as an access point (a.k.a. wifi hotspot) and It is running this code:
serverSocket = new ServerSocket(serverPort);
serverSocket.setReuseAddress(true);
while (RUNNING) {
try {
final Socket socket = serverSocket.accept();
I will have some other client device connect to this device's wifi hotspot, and try to connect to the socket, and it will not be able to.
The access point's ip address is something like 192.168.43.1 ... so I will try to connect from the client device to 192.168.43.1:8080 and it will not work.
However, if both devices are connected to another wifi network, the serverSocket.accept(); will work just fine! I am using port 8080.
Do I need to tell the server socket to accept on the interface "ap0"? (Can I do that?) Is it a firewall issue on the android device?
Any solutions/ideas/suggestions are appreciated!
Edit:
I changed the port to 8988 and now it works just fine! ... Could it be a firewall issue? Any ideas how to navigate this issue?