confused by various UDP checksum algorithms

Guest #2983151
Rate this post
• ▲ useful
▼ not useful
hello forum,

I am trying to send an UDP packet (contains only "TEST" string)
from STM32 to VB6 winsock
I can see packets going with wireshark software

however winsock data_arrival subroutine never gets called
( if I send from laptop winsock to PC winsock or vice versa  UDP packet 
is received OK )

I am suspecting that I cannot calculate UDP checksum correct

in google every single example calculates the UDP checksum different way

my question ,

has anybody a correct algorithm for UDP checksum ?
( which he has tested to be true )

thank you
Guest #2983193
Rate this post
• ▲ useful
▼ not useful
I have run uIP demo supplied with the development board already - no 
problem

however uIP code is too complex to understand

besides I dont need TCP/IP
I only need send an receive a simple UDP packet to PC

coming to UDP checksum ; I have tried with checksum field zero
no success
#2985389
Rate this post
• ▲ useful
▼ not useful
Packets which are invalid at the ethernet level won't arrive at 
Wireshark. Also, in my experience, Wireshark complains when it 
encounters a bad packet. Since Wireshark does not complain (in the 
screen shot shown above), it likely is formally correct at the UDP level 
as well.

Since you had a working packet sent via laptop: Is the checksum really 
the only difference between those frames? Doing a side by side 
comparison.

Concerning the checksum: You told, that you already found several code 
snippets for it. Likely most or all of them produce a correct result at 
least on the platform they were written for. So getting a few more 
slightly different snippets likely won't help a lot.

Anyway, there are authoritative sources: The RFCs for UDP (768) and for 
the IP checksum calculation (1071). RFC 1071 even includes sample code.

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.