Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

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?

share|improve this question

migrated from electronics.stackexchange.com Apr 11 '14 at 23:44

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Yes, I have Bridge.begin(); and YunClient client = server.accept(); is there within the loop. I'm able to access everything internally, just not externally. –  Pat Feb 26 '14 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 Feb 26 '14 at 17:50
    
@Pat Glad to have... ahem... "helped" :-) –  FredP Feb 26 '14 at 17:53
    
You did! I wasn't sure if noListenOnLocalhost() was correct, and the documentation on noListenOnLocalhost vs listenOnLocalhost wasn't overly clear (I think they both say the exact same thing). –  Pat Feb 26 '14 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 Feb 26 '14 at 17:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.