i was thinking, the htons function converts a small endian value to a big endian value, well, intel have an opcode which does exactly the same thing (as ar as i can tell it does) bswap i.e: 31-24|23-16|15-08|07-00 ^ ^ ^ ^ \ \___/ / \____swap_____/ sorry, thats not very clear, byte the highest byte is swaped with the lowest, and the two middle bytes are exchanged. the only problem with bswap is it is 486+, but i dont know if that is gonna be much of a problem now.
Posted on 2001-01-27 22:53:00 by X
Well most of us winsock programmers aren't too conserned with speed when translating IP addresses, and would rather be 100% compatable to ensure good operating code. Now does not the byte order also change between big endian and little endian? I don't remember, but I thought it did. - Ben
Posted on 2001-01-27 23:43:00 by cyberben