[UDT] UDT to AIX portability, byte order, endianess problem
Brought to you by:
lilyco
From: <f....@fz...> - 2006-06-13 12:52:22
|
Hi I am trying to port UDT to AIX. Aside from some compiling difficulties (most of them arising due to gcc bugs - I had to use gcc version 3.2.1 - and the pthreads - see the additional flags in my Makefile below), I could not get the app/appserver/appclient application to work across AIX/POWERPC-boarders, meaning I could run the programs on localhost, even on 2 different AIX machines, and connect, but when trying to connect between AIX/POWERPC and LINUX/INTEL machines I got no connection with timeout errorsn no matter on which side the client/server was sitting. I suspected this to be an issue of byte ordering, and I found it to be in file src/channel.cpp, for example in line 155: const CChannel& CChannel::operator<<(CPacket& packet) const { if (m_bEndianess) { // convert control information into network order if (packet.getFlag()) for (int i = 0, n = packet.getLength() / 4; i < n; ++ i) *((uint32_t *)packet.m_pcData + i) = htonl(*((uint32_t *)packet.m_pcData + i)); // convert packet header into network order packet.m_nHeader[0] = htonl(packet.m_nHeader[0]); packet.m_nHeader[1] = htonl(packet.m_nHeader[1]); } so on a Big Endian architecture (m_bEndianess = true) this does a htonl(), converting the byte order from host to network order, but on a Little Endian architecture it doesnt. >From my understanding Network Byte Order IS ALREADY Big Endian, so shouldn't the littleendian machine actually do this conversion (an the bigendian skip it)? There are a few more htonl()s like the one above. I got everything to work with the changes in the source I pasted in below. Any further hints and suggestions for porting UDT to AIX are welcome :-) Kind regards, Franz Petri. PS: Just for curiousity: Did anybody get this to acutally work on OSX/POWERPC?! Or are the "Mac"-Powerpcs not bigendian? |