Skip to content
This repository has been archived by the owner on Mar 6, 2018. It is now read-only.

Caused by: java.net.ConnectException: Connection refused: connect #104

Open
VivekKulanthaisamy opened this issue Jul 9, 2014 · 1 comment

Comments

@VivekKulanthaisamy
Copy link

socket = new SocketIO();
socket.connect("http://10.0.0.71:9092", this);// local ip address

// Sends a string to the server.
socket.send("Hello Server");

// Sends a JSON object to the server.
socket.send(new JSONObject().put("key", "value").put("key2",
        "another value"));

// Emits an event to the server.
socket.emit("event", "argument1", "argument2", 13.37);

}
While using this code for creating server connection and by using socket.io.jar v1.0.

I get the following error
io.socket.SocketIOException: Error while handshaking
at io.socket.IOConnection.handshake(IOConnection.java:322)
at io.socket.IOConnection.access$600(IOConnection.java:39)
at io.socket.IOConnection$ConnectThread.run(IOConnection.java:199)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

@onuradsay
Copy link

Try adding following line to your AndroidManifest.xml file. This should solve the connection error but if you are using socket.io 1.0.x this library won't work. I added @francoisTemasys's fork as a dependency and everything worked like a charm.

    <uses-permission android:name="android.permission.INTERNET" />  

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants