Hi, this must sound stupid to you, but I'm ages out of Python and I just can't find a function to convert 4 bytes of binary data to an integer value: length=f.read(4) # get length in binary length=socket.htonl(length) # swap bytes #convert 4 bytes to integer f.close() Thanks for any help Uwe --