TCPClient connect() problem

I have a database IDE I’m using for back-end development. It has an http server as the front of the back end (hmmm, that’s a weird turn of phrase), and when I use the system on my local computer, I have no problem connecting to the http server from my Spark Core using TCPClient.connect().

However, when I deploy this system to the cloud (I believe the service is hosted on AWS), connect() fails.

One difference between local and cloud deployment is that I can use the IP variant of connect() locally, but I have to switch to the URL variant when connecting to the cloud - there is apparently a proxy in the middle.

Anyway, any guidance on what to look for here? Some hypotheses:

  1. The DNS lookup is taking too long and connect() times out. (I retry connect() 5 times before giving up).

  2. The proxy creates problems for the connect() function.

  3. There are gnomes in the cloud. (Not likely, I admit)

Also, I notice from checking out github that there is some sort of DEBUG capability in the TCPClient library. Any ideas on how to turn that on to perhaps get a more verbose readout of what’s happening?

Any help would be greatly appreciated. Cheers,

L3

Hi @leo3linbeck

Some folks have been having trouble with DNS configuration. The TI CC3000 on the Spark core seems to get a bad DNS server and things don’t go well after that.

Can you run this test program and see if the DNS server makes sense?

void setup() {
    Serial.begin(9600);
}

void loop() {
    IPAddress dnshost(ip_config.aucDNSServer[3], ip_config.aucDNSServer[2], ip_config.aucDNSServer[1], ip_config.aucDNSServer[0]);
    Serial.print(dnshost);    
    delay(10000);
}
1 Like

@bko,

I got 172.16.1.116. I guess that makes sense in that it’s on my local router. It matches the default DNS shown in Network under System Preferences on my Mac.

Does that help? Appreciate your help and guidance. Cheers,

L3

One more thing - I tried using “www.google.com” and TCPClient.connect() failed with that as well.

Seems like there’s definitely something weird happening with the DNS. I’ll keep digging.

Cheers,
L3

Try the code here in the link below, if the ip lookup returns 0.0.0.0 even with the correct DNS (your gateway address) in the info at the top then your router isn't set up properly for DNS.. and your in the same boat as me at the present time! ive tried setting the DNS manually in the router and still no luck. if i work it out ill let you know

Hi @leo3linbeck

It sounds like your DNS server is being found OK. Maybe you should post some code since there might some other problem we could spot. It should be working for you.

Will do. Won’t get to it until tomorrow (other pressing work beckons :wink: but I’ll do it.

I’m also going to try the alternate gethostbyname() that someone posted here a while back. Will report back anon.

Cheers,
L3

1 Like