[Tutor] Problems with unsigned integers
loptr.chaote at gmail.com
Mon Dec 13 18:52:14 CET 2004
On Mon, 13 Dec 2004 12:43:17 -0500, QoD SEC <qodsec2 at gmail.com> wrote:
> I do not believe that python has anything like signed and unsigned
> integers. The 'L' after an integer makes the number a type long (which
> is not the same as C's long). Also in your code you do this seq =
> socket.ntohl(struct.unpack("L", data[38:42])) which overwrites
> whatever you assigned it before and returns an integer, in your case a
> -1 which might be that the functions is returning an error.
Thanks for the reply. I forgot to say that I have also tried without
the socket.ntohl(), making sure that it's not what messes things up.
Python clearly has _some_ kind of sense for signed vs unsigned if you
check the list* of available fmt-characters.
And the values I get are mixed high ["correct"] values and negative
values, so error return codes does not seem to be an option.
More information about the Tutor