Pages: 1 [2]   Go Down
Author Topic: multiple bugs in ethernet library  (Read 3260 times)
0 Members and 1 Guest are viewing this topic.
Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 638
Posts: 50304
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd debug this by creating a function to replace all calls to client.print(). In the new method, do a client.print() and a Serial.print() with the same data. If the serial monitor shows the data correctly, but the browser does not, upgrade to Firefox.

If both are wrong, fix your code.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

I'd debug this by creating a function to replace all calls to client.print(). In the new method, do a client.print() and a Serial.print() with the same data. If the serial monitor shows the data correctly, but the browser does not, upgrade to Firefox.

If both are wrong, fix your code.


Good idea. I tried it, but was stumped on how to pass the pointer to the function:

Standard way:

Code:


EthernetClient client = = server.available();

client.println("<HTLM xxx>");
client.println("<HTML yyy>");



Passing by function:

Code:

EthernetClient client = = server.available();

void Func1(EthernetClient clientptr) {
   clientptr.println("<HTML xxx>");
   clientptr.println("<HTML yyy>");

}

Loop() {
  Func1(client)
}


By this does not seem to work.

Do anyone know of an example with a lot of HTML on a SD card, which is loaded and served to the client (I could then just modify this example)?

Thanks

Klaus
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 638
Posts: 50304
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
By this does not seem to work.
Does not compile? Does not link? Does not send any output to the client?

Come on, now. "does not seem to work" is lacking in meaning and direction.

Pass by reference is probably what you need to do.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There probably also is another infinite loop in Ethernet\utility\socket.cpp function sendto()
if it was not possible to send data because for example the host is down (no reply to arp) then the function will get stuck waiting for SEND_OK that never arrives.
i was wrong about this.
i was accidentally using a null buffer to sprintf() when i didn't get a reply and overwrote the ram memory with crap.
i should have noticed this earlier, since i didn't i was looking for the problem in the wrong place.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There probably also is another infinite loop in Ethernet\utility\socket.cpp function sendto()
if it was not possible to send data because for example the host is down (no reply to arp) then the function will get stuck waiting for SEND_OK that never arrives.
i was wrong about this.
i was accidentally using a null buffer to sprintf() when i didn't get a reply and overwrote the ram memory with crap.
i should have noticed this earlier, since i didn't i was looking for the problem in the wrong place.

Can you explain that a little more... I'm having an issue where a udp.write just hangs forever so I'm wondering how you found this ?
Logged

Pages: 1 [2]   Go Up
Jump to: