Skip to content

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

@eshiett1995

Description

@eshiett1995

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): dart-lang/http#1604 _RootZone.runUnary (dart:async/zone.dart:1379:54)
E/flutter ( 6573): dart-archive/web_socket_channel#2 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter ( 6573): dart-archive/web_socket_channel#3 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:642:45)
E/flutter ( 6573): dart-lang/http#1605 Future._propagateToListeners (dart:async/future_impl.dart:671:32)
E/flutter ( 6573): dart-archive/web_socket_channel#5 Future._completeWithValue (dart:async/future_impl.dart:486:5)
E/flutter ( 6573): dart-archive/web_socket_channel#6 Future._asyncComplete. (dart:async/future_impl.dart:516:7)
E/flutter ( 6573): dart-archive/web_socket_channel#7 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 6573): dart-archive/web_socket_channel#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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions