Go Down

Topic: Arduino Ethernet and External Web Server (Read 2016 times) previous topic - next topic


Hi, i'm using the <etherShield.h>,
I was able to write data on a webserver hosted on my computer, but when I tried to change the server from my computer to my dedicated webserver, is seems to not write any data.

My code is here http://pastebin.com/m441e38e6

If anyone could help! Thanks

Ran Talbott

A few obvious questions to start with:

1. Are you running the same webserver software on both machines?

2. Are your PC and the dedicated server on the same LAN?  Or is there something like an internet link that would add a lot of latency?

There have been complaints about connections to webservers being dropped because the Arduino didn't send the data soon enough to satisfy the host,  or didn't maintain the connection in a way that kept it happy.  Some webservers are said to be more tolerant of these problems than others.  So the host info may be more important than the code.



No, im not the same webserver software, but basically the same, apache... php.

I own a dedicated ubuntu box, and when I try the code by hand
ex: /daniel/save.php?pwd=segredo&temp=10

it works.

I dont think the problem is with the server,
but somehow the data is not leaving my home network, somehow to add the router IP and gateway. But im new to ths code and dont fully understand it yet.


Ran Talbott

but somehow the data is not leaving my home network

There's your trouble,  dude.

To get it off the LAN,  you have to get the Arduino to route it through the "gateway" to the outside world.

Which I only know how to do for PCs,  because my limited experience with the Ethernet shield has been strictly talking to clients and servers on my LAN.  But searching for "router" or "routing" and "gateway" should turn up the info you need to make it connect to the outside server.




From your first post I would guess you're not using the offical arduino shield but one based on the ENC28J60 chip. I have a number of these and use them successfully to communicate with servers on the internet by specifying the IP address of your ADSL/Cable router.

Have a look at http://blog.thiseldo.co.uk/?p=329 to sy my updated library for this shield. Example code includes a simple twitter client.

Hope this helps  ;)




Hi, from your code, the twitter client doent compile,
it says that there is a problem on line 102

 if (es.ES_find_key_val(str,kvalstrbuf,10,"mn")){

with the error:

In function 'int8_t analyse_get_url(char*)':
error: 'class EtherShield' has no member named 'ES_find_key_val' In function 'void loop()':

Don't know what to do. Thanks



I've had a quick look at this adn I can only reproduce it if I edit the #define statements in ip_config.h. This was tried on version 0017 with the ethershield library installed in the sketchbook directory not the hardware/libraries directory.

To get it working use the following at the end of the ip_config.h file

// functions to decode cgi-form data:
#define FROMDECODE_websrv_help

// function to encode a URL (mostly needed for a web client)
#define URLENCODE_websrv_help

The client example is actually operating as both a client and server so needs both bits enabling.

If the above doesnt fix it then let me know.  :-[



Go Up