Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I am a beginner at Arduino and electronics generally. Web development however I am well practised at.

I have a very small Arduino project and I am attempting to upload updates from my Ethernet Shield mounted Arduino to a website. Since the updates will be saved to a database, I decided to send GET requests so I can write code to retrieve the data on the website and save to the database.

The following is my Arduino code where I am attempting to perform the GET request:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte my_ip[] = { 172, 198, 0, 6 };
byte server[] = { 158, 81, 108, 34 };

Ethernet.begin(mac, my_ip);  
Serial.begin(9600);

  delay(1000);

  Serial.println("connecting...");

  if (client.connect(server, 80)) {
    Serial.println("connected");
    client.println("GET /arduinoProjects?q=arduino HTTP/1.0");
    client.println();

    Serial.print("CLIENT: ");
    Serial.println(client);

  } else {
    Serial.println("connection failed");
  }

My website is at http://158.81.108.34/arduinoProjects(not the real url). As there is no arduino page, I expect the get request to register as page not found - that way I know the GET request was successfully received.

The problem is all I get from my Arduino serial port is connection failed. I have been trying to follow this example.

I don't know how to fix this. I really would appreciate any help.

share|improve this question
You may want to examine your server logs, and/or run tcpdump (or windump) on the server or a machine through which the traffic is being routed in order to monitor the traffic / connection attempt. If you cannot do that, run a server on your development machine and start by hitting that instead. – Chris Stratton Nov 15 '12 at 20:56
the server logs don't indicate the url I am trying to hit. I'm not familiar with tcpdump but I'll start looking into it – sisko Nov 15 '12 at 21:28
dies the get request work with the full uri? e.g. GET blablahb/arduinoProjects?q=arduino – geometrikal Nov 17 '12 at 11:07

closed as off topic by Leon Heller, Brian Carlton, Olin Lathrop, Dave Tweed, W5VO Nov 20 '12 at 4:33

Questions on Electrical Engineering Stack Exchange are expected to relate to electronics design within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.