From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,5bcae0baee38d312,start X-Google-Attributes: gidfee84,public From: adrian@expersoft.com (Adrian Wenden) Subject: unaligned access Date: 1995/05/20 Message-ID: <3plnvd$gks@chomolangma.expersoft.com>#1/1 X-Deja-AN: 102952165 distribution: usa organization: Expersoft newsgroups: comp.unix.osf.osf1 summary: Streaming a 64-bit address representation over the network Can anyone help? I am running OSF 3.0 on an Alpha 400 and compiling using the native 5.0 C++ compiler. The application: One process creates an object (A). One of A's data members is a pointer to another object, B. Object A is then streamed to another process. The receiving process performs some operations on Object A, obviously ignoring the Object B pointer, and sends Object A back to the sending process. When the application used to run on a 32-bit architecture, we cast Object B's pointer to an unsigned long and used the network functions htonl to convert the byte ordering before streaming, and ntohl on the receiving side to alter the byte ordering back to the machine format. All worked fine, until we tried to port it to a 64-bit architecture. The problem: What happens now is that the htonl function only reads the first 4 bytes, and therefore corrupts Object B's 8 byte pointer value, making it useless when Object A is returned to us. We then tried using a64l, and l64a functions to convert the 64-bit address into a base64 string, and stream the string instead of the unsigned representation. As far as the contents of Object A is concerned it is reconstructed correctly when it is returned from the the remote process, however when we attempt to use the object we get 'Unaligned Access pid= = va=332e31386bde pc = 120179b9c ra = 120179b78 type = ldq. Help: Has anyone had either, any experience of streaming 64-bit numbers across the network or come across an unaligned access message, and can explain to me how I can determine what has become unaligned and how I could correct it? Many thanks Adrian Wenden adrian@expersoft.com Expersoft Corporation San Diego, CA (619) 546 4100 x45