UDP Checksum problem


 
Thread Tools Search this Thread
Top Forums Programming UDP Checksum problem
# 1  
Old 06-18-2010
UDP Checksum problem

Hello sir,,

i m doing network programming in C
could u plzz let me know...at the time of udp checksum calculation does htons() or ntohs() play some role..??
i mean will there be any difference if some values are added in network form and other is in the host form...

Thnx 4 ur time..

Waiting for the reply...
# 2  
Old 06-18-2010
I'm sorry, but I've no idea what you're asking. Maybe I'm just having an off day and missing something, but could you please clarify your question? Maybe with a quick example?
# 3  
Old 06-18-2010
thnx a lot sir 4 ur reply..
sir,in the udp checksum computation part one has to add all the 16-bit fields of udp header,pseudo header and data payload...and the fileds can be either in network format or in host format..sir, i want to know whether it is required to convert all the fileds in network format or in host format..!1

thnx once again..
# 4  
Old 06-18-2010
Quote:
Originally Posted by nirucool89
i want to know whether it is required to convert all the fileds in network format or in host format..!
Any arithmetic (such as computing checksums) must be done after the fields have been converted to host format. Network byte order is only for transporting over the network.

If you did the computations without changing from network to host order first, then two machines with different endianness would compute different checksums. For example, one would see 0x00ff as decimal 255 and the other would see it as decimal 65280. If the checksum merely required doubling this number as an unsigned 16-bit integer with overflow (for example) then the first machine would yield 510 (0x01fe) and the second 130560 (0x1fe00; note the overflow).
# 5  
Old 06-18-2010
thnx a lot sir....with help of your suggestions i corrected my code... Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to get checksum of itself

is there a way to get a script to do a checksum on itself? something like this: #!/bin/sh myexpectedsig=$(cksum $0 | awk '{print $1}') if ; then exit else who uptime date fi im looking for something that would always represent the running script, which is why im... (6 Replies)
Discussion started by: SkySmart
6 Replies

2. Solaris

MD5 checksum

Hi Guys, I have about MD5 checksum so many times but I can't figure out how to use it. Can someone please show me how to perform an MD5 checksum? Thanks a lot guys. (1 Reply)
Discussion started by: cjashu
1 Replies

3. IP Networking

Wireshark UDP checksum bad checksum

Hello I am communicating with two devices using my computer over UDP protocol. The application is running fine. When I monitored the UDP traffic using Wireshark software, I found that there were too many Checksum errors. Please find attached the png file showing this error. I am about to... (0 Replies)
Discussion started by: AustinCann
0 Replies

4. Solaris

md5 checksum what does it do

Hello good people, I came across md5 checksum. Can anyone please explain to me what it does and if possible an example of how to use it? Thank you very much (1 Reply)
Discussion started by: cjashu
1 Replies

5. Shell Programming and Scripting

Checksum+SFTP

Hi ALL, I use solaris OS and SFTP to get/put files from remote server.I use the below command , sftp user@host<<EOF cd "dir" get --checksum "filename" EOF I am getting a strange error as " get --checksum INVALID paramter". It has been working succesfully since last 3 years but all of a... (1 Reply)
Discussion started by: mohanpadamata
1 Replies

6. Solaris

checksum

Anyone can tell me the different between "cksum" and "sum" command on Solaris? I read the man pages but still not get it. And how to display the md5 checksum for a file. Thanks, (1 Reply)
Discussion started by: redstone
1 Replies

7. Programming

UDP File Transfer Validation and Checksum

Dear All I have written a client server program for file transmission from one system to other using UDP. Can i use the cksum number in the udp header to validate if the received packet is corrupted or not? If yes, how can i extract the header and validate it.. Also is there any way that... (3 Replies)
Discussion started by: iamcollins
3 Replies

8. Programming

Problem with UDP based application

I am developing a client-server application. All communication is UDP based. I am sending 1000 packets per second. Every packet having size 15 bytes. At receiving end many packets lost. Please tell me if there any solution for this problem or it is actually problem with UDP. (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

9. SCO

checksum

Does anyone know the answer to this? When I run "sum -r" on a file that I've down loaded from the sco website, the 1st set of numbers differs from the checksum on the download page but the 2nd set matches. If I try to install the patch, I get errors. Anyone has an answer? (3 Replies)
Discussion started by: jn5519
3 Replies

10. Shell Programming and Scripting

Checksum question

in HPUX: I am copying oracle datafiles from one mountpoint to another the total size is about 250Gb. I wanted to perform a checksum on the target and make sure the files came overy properly. Mountpoints: /s01 to /u01 /s02 to /u02 I tried using "SUM" on these mountpoints but its taking... (1 Reply)
Discussion started by: jigarlakhani
1 Replies
Login or Register to Ask a Question