Pages: [1]   Go Down
Author Topic: Is dnsLookup() method needed to upload data to cosm????  (Read 1095 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is  dnsLookup() method needed to upload data to cosm?? On running the code for dnsLookup() am getting failed replies as below
Quote
Client Demo
Setting up DHCP
My IP: 192.168.1.102
Netmask: 255.255.255.0
GW IP: 192.168.1.1
DNS IP: 208.67.222.222
DNS failed
SRV IP:   0.0.0.0
I ran the code from the page http://www.lucadentella.it/en/2012/02/19/enc28j60-e-arduino-3/
In some forums i read about DDNS enabling in the router..Is it really needed ?? my router doesn't have DDNS. is it possible to make the code work without enabling DDNS??? My ultimate aim is to upload some data to cosm..somebody pls guide me on this..Am using Enc28j60 ethernet shield..
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 30
Posts: 1670
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it really needed ??

I think the short answer is "no".

I don't understand any of the code in the link you mention but I do understand the date, and that is enough to make the lucadentella article suspect. I believe there was a substantial change to the way cosm  works was made about the middle of last year.  This involved the publication of new libraries, cosm and HttpClient, and the problems people have with cosm are invariably caused by not using them.

However, my not understanding the code may also be due it being specific to the enc28j60, rather than the WIZ5100 that nearly everybody uses with cosm. I'm not so sure if the new libraries and the simplified use of cosm applies to the enc28j60.  

There has been some discussion in the last couple of weeks on the cosm forum about using the enc28j60. I believe it was successful, and you should try there. I don't think you need to worry about the router.
 

« Last Edit: March 18, 2013, 10:38:13 am by Nick_Pyner » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for checking on the code.Not just this code even the example code in the ethercard library for Enc28j60 to get DHCP and DNS also gives DNS failed result. That is the reason why i got a doubt on the router.
Code:
// This demo does web requests via DHCP and DNS lookup.
// 2011-07-05 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>

#define REQUEST_RATE 5000 // milliseconds

// ethernet interface mac address
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
// remote website name
char website[] PROGMEM = "google.com";

byte Ethernet::buffer[700];
static long timer;

// called when the client request is complete
static void my_result_cb (byte status, word off, word len) {
  Serial.print("<<< reply ");
  Serial.print(millis() - timer);
  Serial.println(" ms");
  Serial.println((const char*) Ethernet::buffer + off);
}

void setup () {
  Serial.begin(57600);
  Serial.println("\n[getDHCPandDNS]");
 
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");

  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");
 
  ether.printIp("My IP: ", ether.myip);
  // ether.printIp("Netmask: ", ether.mymask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);

  if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);
 
  timer = - REQUEST_RATE; // start timing out right away
}

void loop () {
   
  ether.packetLoop(ether.packetReceive());
 
  if (millis() > timer + REQUEST_RATE) {
    timer = millis();
    Serial.println("\n>>> REQ");
    ether.browseUrl(PSTR("/foo/"), "bar", website, my_result_cb);
  }
}
The below portion of the code is which fils to get DNS data..I tried the codes at my university campus.
Code:
if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
  ether.printIp("Server: ", ether.hisip);
So is there any changes to be done in the router even for W5100 ethernet shield to upload data to cosm??
Thanks for the tip on the cosm forum on enc28j60. I will check on that...
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 48
Posts: 3402
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try a different DNS server - google's perhaps: 8.8.8.8
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 30
Posts: 1670
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So is there any changes to be done in the router even for W5100 ethernet shield to upload data to cosm??

No. The only time that I am aware of where you need to fiddle with the modem is where you do NOT want distribute your data through cosm but want to have your own computer directly accessible instead.  This is called port forwarding, but I don't know anything about it.

Since you ask the question and if you have half a mind to change to W5100, I suggest you go for it and eBay the ENC, thereby enabling you to march behind the same band as most everybody else. If you do this, make sure you get the latest libraries cosm and Httpclient, and also make sure you ignore all information on cosm that is more than six months old.

Note that there are other Internet of Things services. I don't think they are any better than cosm, but they may be more appropriate for use with the ENC28J60. I understand cosm is specifically designed for the Arduino + W5100.
 
Quote
Thanks for the tip on the cosm forum on enc28j60. I will check on that...

Note the "It Works!" section of the cosm forum. There you will find a wealth of examples, including one of mine(!)..
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Nick and Wildbill... smiley :)the code worked when i connected in a diferent LAN setup.The network at campus uses opendns...that might be the reason..Thats d only difference from the present setup..
Logged

Pages: [1]   Go Up
Jump to: