Arduino ethernet shield make a get request but no response

I would like my arduino to send a get request to a uri I have on my local network. I can open a browser and manually paste the request in and it works. I have also made the same request on a webpage using jQuery again no problem.

I have followed the tutorials for the Arduino and I can't see what I am doing wrong if some could help would be very grateful.

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server(192,168,0,34);

// Set the static IP address 
IPAddress ip(192,168,0,177);

// Initialize the Ethernet client library
EthernetClient client;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
Ethernet.begin(mac, ip);

// give the Ethernet shield a second to initialize:
delay(1000);

}

void loop()
{
 Serial.println("connecting...");

   if (client.connect(server, 81)) {
   Serial.println("connected");

   client.print("GET /tenHsServer/tenHsServer.aspx?t=ab&f=ToggleDevice&d=");
   client.print("E3");
   client.println(" HTTP/1.1");
   client.println("Host: 192.168.0.34");
   client.println(""); //mandatory blank line 
 } 
 }

Answers


For this kind of issue you should learn about web debbugging tools. My favourite is fiddler2. However it is only available for windows. For other plattforms search the net for http debug proxy. Besides that there is always wireshark or ncat.

Once you have such a tool in place just have a look at the generated traffic and compare it with traffic that actually worked. This usually allows to pinpoint the issue rather quickly.


Need Your Help

A large input from console in C++

c++ string input console getline

I need to enter more than 10000 integers, smaller than max long long directly into console. The console accepts something more than 9000 of them using getline(cin,string). Inputting them one by one...

Create Subdomain(s) on Virtual Host on Ubuntu

linux apache-2.2 ubuntu domain-name-system virtualhost

i m using ubuntu &amp; wants to Create Subdomain on Virtual Host for local host.