Go Down

Topic: Stackoverflow Bug? (Read 3502 times) previous topic - next topic

Tasty

Hey,
Ive got a Problem with this Code: http://pastebin.com/NegXa8cS
The Error wenn Compiling/Uploading is this: http://pastebin.com/4UpydAcx

if i change the Code to this: http://pastebin.com/e3HnYTBK
i can upload it, but all other clients like firefox can't connect to it, its giving me an "connection interrupted" / "Verbindung Unterbrochen" (in german)

What can i do to fix this?

Thanks,
Greetz

robtillaart

#1
Apr 11, 2012, 06:28 pm Last Edit: Apr 11, 2012, 06:32 pm by robtillaart Reason: 1
The java error's indicate an error in the IDE, maybe your java needs an update.

On what board are you running this code?

finally I see ...String ... in the code and I know this class is not the most memory efficient.

and the line starting with

client.println("<!DOCTYPE html> ....

is only runnable on a MEGA I assume.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

dxw00d

And a truck load of client.print() statements eating your SRAM.

Tasty

"finally I see ...String ... in the code and I know this class is not the most memory efficient. "
Should i use char instead?

"On what board are you running this code?"
Its not an original arduino board, its the arduino board from here: http://www.franzis.de/elektronik/lernpakete-elektronik/franzis-lernpaket-fuer-arduino

"maybe your java needs an update."
would an java update help?

"And a truck load of client.print() statements eating your SRAM."
I used this method to check if it cant handle the long string, but if i do it like this its uploading, if i do it in one long string, it doesnt upload and give me the error i posted above.

Thanks for the answers. ;)

dxw00d

Which version of the IDE are you using?

Each of the character literals in the client.print() statements is moved into SRAM before your code starts running. I haven't counted the number of characters, but you only have 2KB of SRAM, and those strings are eating a lot of it.

Tasty

#5
Apr 11, 2012, 07:09 pm Last Edit: Apr 11, 2012, 08:54 pm by Tasty Reason: 1
So would char fix it? or is there any other method to load such a big html file?, maybe switch to sdcard load the html file and then switch to the wiznet chip?

dxw00d

Which version of the IDE are you using?

The answer is to keep things in flash, and find a way to stop them being copied into SRAM. If you are using IDE 1.0, then there is an easy way to do that, with the F() macro. This
Code: [Select]
          client.println(F("HTTP/1.1 200 OK"));
prints the string directly from flash.

Tasty

Im using the 0023 IDE, should i download the 1.0?

robtillaart

Quote
Im using the 0023 IDE, should i download the 1.0?

what is holding you back to try?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Tasty

#9
Apr 12, 2012, 12:11 pm Last Edit: Apr 12, 2012, 12:25 pm by Tasty Reason: 1
ok so i downloaded now the 1.0 IDE and tryed this code: http://pastebin.com/5YUzMQxX
and i still get this error: http://pastebin.com/34XGByJd

if i use this Code: http://pastebin.com/ZePNgA30
the IDE says the sketch is too big..

What could i do now to solve it?

robtillaart

#10
Apr 12, 2012, 12:23 pm Last Edit: Apr 12, 2012, 12:28 pm by robtillaart Reason: 1
It definitely looks like a bug in the IDE application, not the Arduino code

- what platform do you use? mac linux PC?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Tasty

#11
Apr 12, 2012, 12:26 pm Last Edit: Apr 12, 2012, 12:29 pm by Tasty Reason: 1
Im using an PC.
This Java-tester is saying me that i have the version 1.7.0_03

dxw00d

Perhaps a 6000+ character string is too long.

Tasty

yeah, but how could i trick it?, for example put the html file on my sd-card then read it and then display it, would that work?

dxw00d

Split it up and send a number of shorter lines.

Go Up