I am trying to access my Arduino Yun from the internet, and it's not quite working. I have correctly port forwarded the port 5555 from the router to the Yun (verified I am able to access my many other NAT'd resources).
I can access the Yun from my internal network.
In the Arduino sketch I have this (among many other things). Mainly taken from example sketches.
#include <Bridge.h>
#include <HttpClient.h>
#include <YunServer.h>
#include <YunClient.h>
YunServer server;
void setup {
// Listen for incoming connections on port 5555
server.noListenOnLocalhost();
server.begin();
}
Is server.noListenOnLocalhost();
the right one to use to access from the outside world?
1 Answer 1
Well, I'm not familiar with the Yun, but the first thing that stands out is the missing
Bridge.begin();
line apparently needed to initialize the Bridge library that you use.
And you do have something like
YunClient client = server.accept();
and "more" in the main loop (or a function where applicable) of your code, right ?
And yes, noListenOnLocalhost()
is the correct function for serving external clients.
-
Yes, I have
Bridge.begin();
andYunClient client = server.accept();
is there within theloop
. I'm able to access everything internally, just not externally.Pat– Pat2014年02月26日 17:46:46 +00:00Commented Feb 26, 2014 at 17:46 -
So your answer helped me validate that what I am doing is correct. I'll mark it as solved. What ended up happening is that my router didn't save the NAT for port 5555. So I re-did that, and it's good. Thanks again for verifying that
noListenOnLocalhost()
is correct for external hits!Pat– Pat2014年02月26日 17:50:57 +00:00Commented Feb 26, 2014 at 17:50 -
@Pat Glad to have... ahem... "helped" :-)FredP– FredP2014年02月26日 17:53:12 +00:00Commented Feb 26, 2014 at 17:53
-
You did! I wasn't sure if
noListenOnLocalhost()
was correct, and the documentation onnoListenOnLocalhost
vslistenOnLocalhost
wasn't overly clear (I think they both say the exact same thing).Pat– Pat2014年02月26日 17:54:12 +00:00Commented Feb 26, 2014 at 17:54 -
The doc is "correct", but indeed not very explicit regarding internal VS external. And I must admit that when I first saw the function name I found it rather suspect.FredP– FredP2014年02月26日 17:58:58 +00:00Commented Feb 26, 2014 at 17:58