Archived

This topic is now archived and is closed to further replies.

checksum?

This topic is 5335 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I haven''t had the chance to test my network code in a "real world situation" yet, all I''ve done is through localhost. My question is, do I need to do any checksum operation on UDP packets to assure valid transmission? I know UDP is an "unreliable" protocol, but to what extent? If this is already implemented in the kernel, then I could spare myself the trouble (and the clock cycles!)

Share this post


Link to post
Share on other sites
checksums are only implemented on the ip and udp levels of the osi model. kernel checks those automatically. if you want to protect your data from being screwed you will have to add a user-level upper protocol on top of udp and implement checksum for the data itself in it...

"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger

Share this post


Link to post
Share on other sites
You have to learn the basics of the OSI stack before you start coding for the net.
Check these out: http://www.geocities.com/SiliconValley/Monitor/3131/ne/osimodel.html
http://www.cisco.com/warp/public/535/2.html
http://www.isi.salford.ac.uk//books/osi/osi.html


"I'll be Bach!" (c) Johann Sebastian Schwarzenegger

[edited by - x33 on May 6, 2003 9:53:31 AM]

Share this post


Link to post
Share on other sites
The UDP checksum includes the user data in the packet so you don''t have to worry to much about data corruption on the first pass of your app.

The problem is that in the real world routers try to be smart and tend to rewrite packets. As part of this process they compute a new checksum. Routers have been known in the past to be buggy, corrupt the data, and recompute a new checksum based on the corrupted data. The only way to detect this is to have a user-level checksum as well.

This scenario is one of those things that will probably never effect you, but it usually doesn''t hurt to much to handle it anyway. If you''re writing throw-away or experimental code don''t bother, but for real code you''ll probably want to do it eventually.

The whole osi thing is pretty much irrelevant to most people imho. It''s one of those things that you read about, go "yeah whatever", then go on to practical issues.

Share this post


Link to post
Share on other sites
hm. oops, made a mistake . udp checksums realy cover all the packet. ip checksums don''t. that''s the difference. sorry.

"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger

Share this post


Link to post
Share on other sites
quote:
Original post by x33
You have to learn the basics of the OSI stack before you start coding for the net.



HAVE to ? I don''t see why.

Share this post


Link to post
Share on other sites
Just to get the basic understanding of what''s going on...

I''ve recently got a help request of such a kind: "What type of sockets do i have to use with the MIME data?" How do i reply on that? I told that guy to learn OSI for the beginning. That''s why.

"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger

Share this post


Link to post
Share on other sites
The question shows that the person has a rather fundamental lack of understanding about network programing but reading up on the osi model probably isn''t going to help him either.

Share this post


Link to post
Share on other sites