MyWifiMesh
MyWifiMesh copied to clipboard
SocketTimeoutException: failed to connect to IP address and port
Hello,
I've been attempting to implement and test this code, but after retrieving the IP address of the connection and starting the client socket, the socket always times out. I believe its because there is more than one of the same IP address, but I may be wrong and am not sure how to fix this problem. The error I receive is "Client: java.net.SocketTimeoutException: failed to connect to / 192.168.49.1 (port 38765 after 5000ms. isConnected failed: ETIMEDOUT (Connection timed out)"
What should happen I believe is that after the client socket connects to the other device's IP address and the access point is removed. There should be a message from the group owner and the client. I actually replicated this, by manually going to my Wifi connections and directly connecting to the other phone.
Note: this screenshot is of my Galaxy S6 Edge, which attempting to connect to a LG G4.
I would greatly appreciate the help!
Thank you!
Jonathan Yang
Or, I suspect that despite the application's attempt to remove the access point in step 6. The device is actually communicating with its own server, hence why the client socket will not connect. However, I am unsure how to solve the problem.
Hey yangster23 were you able to find out the reason behind this behavior? Please share if you have any fix for this!
Sometimes the socket is work and sending the message that in message handler but otherwise always giving that exception. Any clue guys what the problems makes this behavior that causing throwing the exception, I hope Mr. @DrJukka have time for the solution thank you in advance.
Hi kholash, yangster23 has rightly suspected that the client itself has not been able to purge the 192.168.49.1 address.
I solved it by not starting AP service for devices which were acting as client.