Anyone familiar with EtherCard.h or ENC28J60 Ethernet shield?

Good day guys! I'm currently working on a web server switch for my project and here is the code. So far it is working fine, its just having some timeouts after it has been open for more than 30 mins.

#include <EtherCard.h>

// Ethernet Part declaration
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
#define BUFFER_SIZE 800
BufferFiller bfill;
byte Ethernet::buffer[BUFFER_SIZE];
static byte myip[] = {192,168,1,15};
// Ethernet Part ends here

const int ledPin = 6;

void setup () {

Serial.begin(9600);

//Ethernet Debugging

ether.begin(BUFFER_SIZE, mymac, 10);

ether.staticSetup(myip);

//Ethernet Debugging Ends Here

pinMode(10, OUTPUT);
digitalWrite(10, HIGH);

pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
}

void homepage(){
bfill.emit_p(PSTR(
"Ethernet Controller"
"



IP Based Automated
Load Carrier with RFID Security
"
"


" "" "" "" "
Room Destination
" "

Mobot is
" )); } void http_Unauthorized(){ bfill.emit_p(PSTR("HTTP/1.0 401 Unauthorized\r\n" "Content-Type: text/html\r\n\r\n" "

401 Unauthorized

" )); }

void loop() {
//checking for requesting client
word len = ether.packetReceive();
word pos = ether.packetLoop(len);

if(pos) {
bfill = ether.tcpOffset();

//storing buffer on data variable
char *data = (char *) Ethernet::buffer + pos;

if (strncmp("GET /", data, 5) != 0) {
// Unsupported HTTP request
// 304 or 501 response would be more appropriate
http_Unauthorized();
}
else {
data += 5;

if (data[0] == ' ') {
// Return home page
homepage();
}
else if (strncmp("?cmd=GV208 ", data, 10) == 0) {
homepage();
Serial.println("Recieve ON");
digitalWrite(ledPin, HIGH);

}
else if (strncmp("?cmd=GV209 ", data, 10) == 0) {
homepage();
Serial.println("Recieve OFF");
digitalWrite(ledPin, LOW);
}
else if (strncmp("?cmd=GV210 ", data, 10) == 0) {
homepage();
Serial.println("Recieve HALF");
analogWrite(ledPin,150);
}
else if (strncmp("?cmd=GV211 ", data, 10) == 0) {
homepage();
Serial.println("Recieve HALF");
analogWrite(ledPin,10);
}
else {
// Page not found
http_Unauthorized();
}
}
ether.httpServerReply(bfill.position());
}
}

My problem is that when I want to create a better looking webpage, everything stops loading. I guess this is the limited RAM issues? (I'm thing of buying ATMEGA1280 to have more RAM, currently using ATMGE328)
While I still dont have a new mcu, is it possible to send the html on multiple packets instead of one so I can host a bigger html file? or is buying a new MCU the only solution for now? or is there any other way I can use a bigger HTML?

Also about the timeouts, is there a problem in my code which is causing the timeouts? Can i do anything to avoid these timeouts and high latency issues?

Another thing how is it possible to use an SD card with this library? I tried using the ETHER_28J60.h library and it is working fine with its ether.print command.
Im having problem using the data I read on my SD on bfill.emit_p command.
What I do is
while (sd.available()){
c= sd.read();
bfillemit_p(c);
}
kinda like this.
this code works fine on other libraries( changing bfill.emit_p with the print command of the other library) but it is not working on ethercard.h library. How do I use my SD right on this library?

THX GUYS and more power to the community!

usa la función F() que guarda las variables string en la memoria de programa.

Saludos de Córdoba Argentina

While I still dont have a new mcu, is it possible to send the html on multiple packets instead of one so I can host a bigger html file?

It isn't the size of a packet that matters. It's where the data is stored that makes up a packet. Use the F() macro to keep the data in flash memory instead of SRAM. Or, store the html in a file on an SD card.