checksum?
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!)
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
"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger
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]
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]
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.
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.
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
"I''ll be Bach!" (c) Johann Sebastian Schwarzenegger
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.
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement