WwwServer library to serve files from SD card: need remote IP address

I’ve created a WwwServer library to serve files from the SD card. It’s designed to split the request into many short tasks (in testing worst case is < 30ms) so that it doesn’t interrupt data logging tasks. For a description and background see http://blog.stevemarple.co.uk/2011/07/web-server-for-arduino.html

The code is here:

I’d like to add access control based on remote IP address, but I can’t see how I can get this information from Server (or Client). Is it possible, and how?

Is it possible, and how?

It is not supported in the standard ethernet library but IIRC I have seen a patch for this several months ago, on this forum or the old one. Have to search for it…

Check - http://arduino.cc/forum/index.php/topic,54378.0.html -

from that thread:

You need a patch in the ethernet library:

on the CLient.cpp file add the following code Code:

Client::Client(uint8_t *ip, uint16_t port) { _ip = ip; _port = port; _sock = 255; }

//what you need to add starts here void Client::IP_address(uint8_t * addr) { W5100.readSnDIPR(_sock, addr); // MY PATCH IDE 21 // getSn_DIPR(_sock, addr); }

Then on the client.h file you should add: Code:

void stop(); void IP_address(uint8_t * addr); //Only add this line as the others already exist uint8_t connected();

Hopes this helpes,

Note that you need to patch this every update of the IDE..