Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant connect to 192.168.0.100:8006 #27

Closed
vrunoa opened this issue Aug 7, 2014 · 5 comments
Closed

Cant connect to 192.168.0.100:8006 #27

vrunoa opened this issue Aug 7, 2014 · 5 comments

Comments

@vrunoa
Copy link

vrunoa commented Aug 7, 2014

I cant manage to connect to a local url,

socket = IO.socket("http://192.168.0.100:8006/");
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
  @Override
  public void call(Object... args) {
    Log.i(TAG_NAME, "connected");
  }
});
socket.on(Socket.EVENT_ERROR, new Emitter.Listener() {
  @Override
  public void call(Object... args) {
    Log.i(TAG_NAME, "error");
  }
});
socket.connect();

i'm getting Socket.EVENT_ERROR and Socket.EVENT_CONNECT_TIMEOUT.

How can I debug this errors on:

socket.on(Socket.EVENT_ERROR, new Emitter.Listener() {
  @Override
  public void call(Object... args) {
    Log.i(TAG_NAME, "error");
    Log.i(TAG_NAME, args.toString());
  }
});

?

@nkzawa
Copy link
Contributor

nkzawa commented Aug 7, 2014

We need more information of the problem.
Can I see server code and the logs of server and client?

@vrunoa
Copy link
Author

vrunoa commented Aug 7, 2014

Nevermind, I was missing the android manifest permissions
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
(Dumb Hat for me)

Either way, how can I debug the Object... args of the Socket.EVENT_ERROR Emitter.Listener ?

@vrunoa vrunoa closed this as completed Aug 7, 2014
@nkzawa
Copy link
Contributor

nkzawa commented Aug 7, 2014

Socket.EVENT_ERROR takes an argument:

socket.on(Socket.EVENT_ERROR, new Emitter.Listener() {
  @Override
  public void call(Object... args) {
    Object arg = args[0];
    Log.i(TAG_NAME, "error: " + (arg != null ? arg.toString() : ""));
  }
});

@vrunoa
Copy link
Author

vrunoa commented Aug 7, 2014

Great! the key is to log Object arg = args[0];

Thanks!

@oliverhausler
Copy link

@nkzawa Maybe you want to make this part of the README. It was unclear to me as well and I expected an exception as argument.

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

No branches or pull requests

3 participants