Posted: Wed Apr 10, 2013 9:34 pm Post subject: bug in PING sample?
Hi!
I'm using a W5200 in a WIZ820IO. It pings a couple of IPs (and does a lot more).
I encoutered some problems, the ram appeared corrupted after the ping.
I found out, that the ping-answer from the pinged IP is 15 bytes long.
The ping sample expects only 12 bytes to receive: dim Rec(12) As Byte.
So if I read 15 bytes to clear the buffer, 3 bytes are written anywhere into the RAM.
I do not know much about the ping protocol, maybe some day I will receive 20 Bytes?
Here is my solution:
As I do not care about the content of the ping answer (the sample does not too), I read the W5200 buffer only into ONE dummy-byte:
dim rec as byte
Res = Tcpread(idx , Rec , Result) 'get data with TCPREAD !!!
Am I right so far?
If so, maybe the sample should be changed.
If you use ping according to the sample, you should check this issue, because sometimes you do not recognize a corrupted RAM, until some fine day strange things happen.
maybe the w5200 puts the header into the data as well. in that case you would need 4 more bytes.
you should clear the buffer by reading 1 byte in a loop till there is no more data. _________________ Mark
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum