ethercard http\tcp Как посмотреть с какого ip пришел запрос.
- Войдите на сайт для отправки комментариев
Сб, 17/02/2018 - 10:02
#include <EtherCard.h> static byte myip[] = { 192,168,1,200 }; static byte gwip[] = { 192,168,1,1 }; static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; byte Ethernet::buffer[500]; // tcp/ip send and receive buffer const char page[] PROGMEM = "HTTP/1.0 503 Service Unavailable\r\n" "Content-Type: text/html\r\n" "Retry-After: 600\r\n" "\r\n" "<html>" "<head><title>" "87.103.200.242 \\ in.khai.pw" "</title></head>" "<body>" "<h3>This service is currently unavailable</h3>" "<p><em>" "The main server is currently off-line.<br />" "Please try again later." "</em></p>" "</body>" "</html>" ; void setup(){ Serial.begin(57600); Serial.println("\n[backSoon]"); if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0) Serial.println( "Failed to access Ethernet controller"); ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); } void loop(){ if (ether.packetLoop(ether.packetReceive())) { memcpy_P(ether.tcpOffset(), page, sizeof page); ether.httpServerReply(sizeof page - 1); } }
Это пример из библиотеки ethercard BackSoon, как можно посмотреть с какого ip адреса пришел http запрос.
https://jeelabs.org/pub/docs/ethercard/ это ссылка на документацию к этой библиотеке.
Очень жду вашей помощи.
http://easyelectronics.ru/ethernet-modul-na-enc28j60.html