1

So I am developing a chat app and whenever I connect to the server IP address (192.168.43.1) via a socket it returns:

java.net.ConnectException: failed to connect to /192.168.43.1 (port 8989): connect failed: ENETUNREACH (Network is unreachable)

The address is correct since I got it from DhcpInfo and the port too is correct because if I supplied localhost on my device, it can connect. Can someone explain here what I am missing.

Thanks for your time.

EDIT:

here is the code for generating the server:

ServerSocket server_socket = new ServerSocket(8989);
Socket client_connection = server_socket.accept();

and for the client:

Socket client_socket = new Socket("192.168.43.1", 8989);

0 Answers0