Search code examples
dartdebuggingremote-debugging

Can't connect on Dart debug through virtualbox


I'm on windows, but on my Virtualbox I have one debian server.
I have create a Dart example and run it with:

dart run --pause-isolates-on-start --observe

With this i can connect to:

http://127.0.0.1:8181/XDFGgXmZ5Xc=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2FXDFGgXmZ5Xc%3D%2Fws

But this link don't work!
When I try to access even inside the Virtualbox with the W3M (command line browser) there is no output.
I have checked for open ports and the port 8181 is open.

Can you guys tell me some ideas to fix this?


Solution

  • You need to change the bind-address since the default are localhost which means only programs running inside your VM can get access to the observatory.

    From dart help run:

    --enable-vm-service=<[<port>[/<bind-address>]]>    Enables the VM service and listens on the specified port for
                                                       connections (default port number is 8181, default bind address is
                                                       localhost).
    

    If you want to make the observatory to every single network interface on your machine, you can change the bind-address to 0.0.0.0 instead. Be sure you don't allow this to be externally accessed from the internet. Alternative, you can specify the IP of the network interface you want the observatory to listen on.

    dart run --pause-isolates-on-start --observe --enable-vm-service=8181/0.0.0.0