[pre lang="arduino" line="1" file="ClientIP"]
#include <net.h>
#include <EtherCard.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
byte Ethernet::buffer[800];
static uint32_t timer;
char website[] = "www.lucadentella.it";
// called when the client request is complete
static void response_callback (byte status, word off, word len) {
Serial.print((const char*) Ethernet::buffer + off);
}
void setup () {
Serial.begin(9600);
Serial.println("\n[webClient]");
if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0)
Serial.println( "Failed to access Ethernet controller");
if (!ether.dhcpSetup())
Serial.println("DHCP failed");
ether.printIp("IP: ", ether.myip);
ether.printIp("GW: ", ether.gwip);
ether.printIp("DNS: ", ether.dnsip);
if (!ether.dnsLookup(website))
Serial.println("DNS failed");
ether.printIp("SRV: ", ether.hisip);
}
void loop () {
ether.packetLoop(ether.packetReceive());
if (millis() > timer) {
timer = millis() + 10000;
Serial.println();
Serial.print("<<<REQ\n");
ether.browseUrl(PSTR("/demo/"), "aphorisms.php", website, response_callback);
}
}
[/code]
错误如下:
- HTTP/1.1 406 Not Acceptable
- Date: Thu, 12 Jun 2014 08:54:55 GMT
- Server: Apache
- Vary: Accept-Encoding
- Content-Length: 101
- Connection: close
- Content-Type: text/html; charset=iso-8859-1
- Blocked by mod_slotlimit. More information about this error may be available in the server error log.
复制代码
此贴完全参照http://www.geek-workshop.com/thread-2098-1-1.html,并解决了DSN failed问题,解决方式是去掉char website[] PROGMEM = "www.lucadentella.it";中的PROGMEM。
求问题解决方法跟出现问题的原因。 |