Electronic – arduino – can’t connect to webserver through arduino

arduinoethernet

I've the following problem and I just can't figure out how to fix it. I'm currently working on a prototype for my thesis. For this prototype I need my Arduino to connect to the internet. I've a Arduino Uno and a Arduino Ethernet Shield.

The problem is that I can't connect to the webserver of my company where I'm currently following a internship.

The webserver has a different IP then the LAN that I'm working on. When I'm typing in my command window ipconfig /all I get the following information:

MAC address: 64-31-50-25-FE-C7

IPv4-address: 10.100.5.144

subnet mask: 255.255.248.0

gateway: 10.100.0.1

The IP address where the webserver is installed is: 10.100.0.40.

When I'm requesting a page with GET and I want to get the file index.html who is stored in my www folder of the webserver (see below), I get the 404 error.

\efocus02\www\evs\navid\navid.mirzaie.milani\webroot

This is the URL that I request: http://navid.mirzaie.milani.navid.efocus02.efocus.local/test.html

Is there someone who can help me how I can figure this issue, I would really, really appreciate it.

Best Answer

As you are getting a 404 error, the Arduino must be correctly connected to the network and able to access the web server.

(My best guess, given limited information, is that the web server is using Virtual Hosting and your Arduino is not sending a "Host:" HTTP header).

In order to debug the problem, you need to see what's going on at the network level. Either, add debugging to your Arduino HTTP library or sniff the network with a PC.

I'd recommend using a PC. Use an ethernet hub (not a switch), or connection share the Arduino through a PC then run WireShark to sniff the network packets. Check that the Arduino really is requesting the page you think it is. Check the response codes coming back.

Recreate the HTTP request on a PC, send exactly the same data - do you get the same 404 response? You can do this with telnet or with a more powerful tool like curl or wget.