Socket values getting currupted

hi
I am using socket programming to transfer my header object form linux machine to unix machine.
when i transfer the object at unix machine the long and int values are getting currupted . So i am getting gatbage values.
but if i am doing this same task for linux to linux machine the same code is woking

what could be the reason behind this grabage value .

please help.

Thankx :

Endianess - big-endian vs little-endian byte order. You probably need to change the byte order on the receiving side.

Call noths and/or nothl to correct the problem.

See man ntohl for more information.

http://beej.us/guide/bgnet/output/html/structs.html\#convert

the problem is due to Endianess.
as one of the machine is linux therefore little-endian and other is AIX therefore big-endian.

can you please explain ntohs function or suggest some sites.

thankx

Dear Bhakti,

have you looked into the Beej's guide for network programing. he has explained very nicely. I just repeate the same for you.

ntohs ==> 'n' -> network
'h' -> host
's' -> small

So you can have other combinations also like ntohl, htons to name a few. I think now you can figure out what ntol must be doing. :smiley:

regards
Apoorva Kumar