stomp
stomp copied to clipboard
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
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.
why is this, and is this specific to emulator or am i calling the wrong tcp port
even using an online websocket url doesnt work connect("ws://echo.websocket.org").then((StompClient client) {
});
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)
I am having the same problem when I try to connect to my local IP. Has anyone been able to solve it?
@Mikaulin no i havent
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 https://github.com/dart-lang/web_socket_channel/issues/41 and I'm not sure if it's in this library or the socket library.
i'm having the same problem. anybody worked out where it's going wrong?
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!
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