I had actually been experimenting with pack() and unpack() before as well but somehow did not get them to work the way I wanted it, probably because of the incorrect input address format. I'll try to understand your sample code and may get back with further questions in case I cannot fathom all depths of it.