Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

bug in PING sample?

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP
View previous topic :: View next topic  
Author Message
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Wed Apr 10, 2013 9:34 pm    Post subject: bug in PING sample? Reply with quote

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.
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Wed Apr 10, 2013 9:51 pm    Post subject: Reply with quote

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
Back to top
View user's profile Visit poster's website
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Wed Apr 10, 2013 11:14 pm    Post subject: Reply with quote

11+4=15; that makes sense.
I will clear the buffer anyway, thanks a lot!
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> EASY TCP/IP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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