confused by various UDP checksum algorithms

Guest #2983151
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
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
Guest #2983273
hello thank you,

here is the wireshark printscreen
winsock cannot receive this packet

I have an USRobotics adsl router between PC and STM32F4
Attached files:
Guest #2984401
hello thank you

I tried with the MAC adress of my PC still no success

by the way my original question still open

can you give me a working UDP checksum algorithm
#2985389
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.
#2985434
And BTW: What sources of information did you use for your code? The UDP 
checksum isn't simply a checksum of all header and data bytes, but this 
should be mentioned in every detailed UDP description.

Reply

A question of your own? This thread is over 13 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

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.