osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Irritating bytearray behavior


On 2019-09-17, Ian Pilcher <arequipeno at gmail.com> wrote:
> I am using a bytearray to construct a very simple message, that will be
> sent across the network.  The message should always be 20 bytes:
>
>    2 bytes - address family (AF_INET or AF_INET6) - network byte order
>    2 bytes - (padding)
>    4 or 16 bytes - IP address

You probably already know this and have rejected it for some reason,
but the struct module is very useful for this sort of thing...

-- 
Grant Edwards               grant.b.edwards        Yow! I wonder if I should
                                  at               put myself in ESCROW!!
                              gmail.com