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

Keep getting SocketException: Failed host lookup: 'ws://10.0.3.2:8080/websocket-example' (OS Error: No address associated with hostname, errno = 7) while trying to connect from an emulator #19

Open
eshiett1995 opened this issue Nov 5, 2018 · 8 comments

Comments

@eshiett1995
Copy link

i am trying to connect to a socket via gennymotion emulator on my local box, using the gennymotion localbox ip of 10.0.3.32, here is my code bellow:

connect("ws://10.0.3.2:8080/websocket-example").then((StompClient client) {

//client.sendString("/foo", "Hi, Stomp");

});

but i keep getting the exception:

E/flutter ( 6573): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter ( 6573): SocketException: Failed host lookup: 'ws://localhost:8080/websocket-example' (OS Error: No address associated with hostname, errno = 7)
E/flutter ( 6573): #0 _NativeSocket.lookup. (dart:io/runtime/binsocket_patch.dart:362:9)
E/flutter ( 6573): #1 _RootZone.runUnary (dart:async/zone.dart:1379:54)
E/flutter ( 6573): #2 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter ( 6573): #3 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
E/flutter ( 6573): #4 Future._propagateToListeners (dart:async/future_impl.dart:671:32)
E/flutter ( 6573): #5 Future._completeWithValue (dart:async/future_impl.dart:486:5)
E/flutter ( 6573): #6 Future._asyncComplete. (dart:async/future_impl.dart:516:7)
E/flutter ( 6573): #7 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 6573): #8 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)

why is this, and is this specific to emulator or am i calling the wrong tcp port

@eshiett1995 eshiett1995 changed the title Keep getting SocketException: Failed host lookup: 'ws://localhost:8080/websocket-example' (OS Error: No address associated with hostname, errno = 7) while trying to connect from an emulator Keep getting SocketException: Failed host lookup: 'ws://10.0.3.2:8080/websocket-example' (OS Error: No address associated with hostname, errno = 7) while trying to connect from an emulator Nov 5, 2018
@eshiett1995
Copy link
Author

even using an online websocket url doesnt work
connect("ws://echo.websocket.org").then((StompClient client) {

});

@zahariaca
Copy link

Having the same issue. Are we doing something wrong?

D/ViewRootImpl@e6d47e4[MainActivity](13974): ViewPostIme pointer 1
E/flutter (13974): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (13974): SocketException: Failed host lookup: 'ws://10.220.0.10:8080/gs-guide-websocket/websocket' (OS Error: No address associated with hostname, errno = 7)
E/flutter (13974): #0      _NativeSocket.lookup.<anonymous closure> (dart:io-patch/socket_patch.dart:353)
E/flutter (13974): #1      _RootZone.runUnary (dart:async/zone.dart:1381)
E/flutter (13974): #2      _FutureListener.handleValue (dart:async/future_impl.dart:129)
E/flutter (13974): #3      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:633)
E/flutter (13974): #4      _Future._propagateToListeners (dart:async/future_impl.dart:662)
E/flutter (13974): #5      _Future._completeWithValue (dart:async/future_impl.dart:477)
E/flutter (13974): #6      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:507)
E/flutter (13974): #7      _microtaskLoop (dart:async/schedule_microtask.dart:41)
E/flutter (13974): #8      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)

@Mikaulin
Copy link

I am having the same problem when I try to connect to my local IP. Has anyone been able to solve it?

@eshiett1995
Copy link
Author

@Mikaulin no i havent

@xbassols
Copy link

xbassols commented Dec 18, 2018

For some reason the VM implementation is with Socket and that requires only an IP address and port and that setup does not work well with sprint.

In order to solve this problem I've used https://pub.dartlang.org/packages/web_socket_channel as socket library.

Here the example:
custom_stomp.dart

For the authentication I'm fighting this problem dart-lang/web_socket_channel#41 and I'm not sure if it's in this library or the socket library.

@Philip-Wu
Copy link

i'm having the same problem. anybody worked out where it's going wrong?

@saurabhgour
Copy link

Hey @xbassols, thanks for the workaround, it works great, since development for this plugin seems to be stopped, could you please fork the repo and include your changes there, it would really be helpful for everyone. Thanks again!

@UnDer-7
Copy link

UnDer-7 commented Oct 18, 2019

For some reason the VM implementation is with Socket and that requires only an IP address and port and that setup does not work well with sprint.

In order to solve this problem I've used https://pub.dartlang.org/packages/web_socket_channel as socket library.

Here the example:
custom_stomp.dart

For the authentication I'm fighting this problem dart-lang/web_socket_channel#41 and I'm not sure if it's in this library or the socket library.

DUDE, THANK YOU, IT FINALLY WORKS. I SPENT TWO DAYS TRYING TO USE THIS LIBRARY

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

7 participants