I am used the below code to connect to a php websocket.
serverAddr = InetAddress.getByName(ip_str);
socket = new Socket(serverAddr, port_str);
mBufferIn = new BufferedReader(new InputStreamReader(socket.getInputStream()));
Trying to open a socket and want to listen to what data is coming from the server.
the ip_str is something like this : wss://xyz.com:8181/game where xyz is the actual host name, and 8181 is a dummy port number(have given dummy values as i cannot give the actual values here - but it is working fine on web as we are trying to connect same socket via web).
On this line :
socket = new Socket(serverAddr, port_str);
I am getting the following error message :
java.net.ConnectException: failed to connect to ip6-localhost/::1 (port 8181): connect failed: ECONNREFUSED (Connection refused)
Anyone has any idea why i am facing this issue?