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.
-
1\$\begingroup\$ You say you need the index.html, but the request URL is for a test.html. Also, did you try accessing the server by IP, like: 10.100.0.40/index.html ? \$\endgroup\$DimKo– DimKo2012年08月09日 13:00:36 +00:00Commented Aug 9, 2012 at 13:00
-
\$\begingroup\$ @DimKo on ip 10.100.0.40 they installed a drupal, so when i'm requesting that IP i'm getting HTML output of the index.html, but i want to acces my folder and get the info of test.htm. \$\endgroup\$Navid– Navid2012年08月09日 13:04:19 +00:00Commented Aug 9, 2012 at 13:04
-
\$\begingroup\$ You are on the incorrect IP range. The webserver is on 10.100.0.40 and your arduino is 10.100. 5 .144 . There is no route to the device. If you got internet request it from the internet instead rather than internally \$\endgroup\$Piotr Kula– Piotr Kula2012年08月16日 08:41:47 +00:00Commented Aug 16, 2012 at 8:41
-
\$\begingroup\$ Not an electronics question. Probably will be closed. \$\endgroup\$Brian Carlton– Brian Carlton2012年08月22日 23:32:34 +00:00Commented Aug 22, 2012 at 23:32
1 Answer 1
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.
-
\$\begingroup\$ Jeffrey, the main problem is that i can't connect to the webserver and i don't know how to accomplished that and i'm really getting a headache as i busy with this issue for many hours. \$\endgroup\$Navid– Navid2012年08月09日 12:50:06 +00:00Commented Aug 9, 2012 at 12:50
-
\$\begingroup\$ You don't need to access the web server or sniff the traffic. You can install on a normal PC on the LAN a web server (XAMPP, to name one), and set arduino to get the page from that PC. You'll see on the log what arduino is really asking. I agree with Toby's best guess: missing host http header. \$\endgroup\$Axeman– Axeman2012年08月09日 13:09:08 +00:00Commented Aug 9, 2012 at 13:09
-
\$\begingroup\$ @Axeman i just installed wamp on my PC and its default on ip : 127.0.0.1 when i'm connecting to this IP through a example code i can't see anything when i'm requesting 127.0.0.1 in my browser. \$\endgroup\$Navid– Navid2012年08月09日 13:18:51 +00:00Commented Aug 9, 2012 at 13:18
-
\$\begingroup\$ I wrote a blog along these lines a while back: blog.wickeddevice.com/?p=245 \$\endgroup\$vicatcu– vicatcu2012年08月16日 04:07:57 +00:00Commented Aug 16, 2012 at 4:07
-
\$\begingroup\$ Forget the Arduino. Just get a Raspberry Pi - What is your thesis about- ripping out hair from stress? \$\endgroup\$Piotr Kula– Piotr Kula2012年08月16日 08:59:49 +00:00Commented Aug 16, 2012 at 8:59