Re: help on packet format for tcp/ip programming

2007-02-08 Thread Grant Edwards
On 2007-02-08, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: struct module pack and unpack will only work for fixed size buffer : pack('>1024sIL', buffer, count. offset) but the buffer size can vary from one packet to the next :-( >>> >>> Oh for Pete's sake... >>> >>> struct.pack('>%

Re: help on packet format for tcp/ip programming

2007-02-08 Thread Grant Edwards
On 2007-02-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Feb 8, 3:40 am, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2007-02-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > struct module pack and unpack will only work for fixed size buffer : >> > pack('>1024sIL', buffer, count.

Re: help on packet format for tcp/ip programming

2007-02-08 Thread Diez B. Roggisch
> Grant had the right idea, I think, but he failed to actually include a > byte length in his format. :) So there's nothing to peek at. If the > packing is done like this, instead.. > > > struct.pack('!IIL', len(buffer), count, offset) + buffer > > Then it is a simple matter to unpack it o

Re: help on packet format for tcp/ip programming

2007-02-08 Thread Jean-Paul Calderone
On Thu, 08 Feb 2007 15:56:30 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: > >> On Feb 8, 3:40 am, Grant Edwards <[EMAIL PROTECTED]> wrote: >>> On 2007-02-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> >>> > struct module pack and unpack will only work for fi

Re: help on packet format for tcp/ip programming

2007-02-08 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On Feb 8, 3:40 am, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2007-02-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> > struct module pack and unpack will only work for fixed size buffer : >> > pack('>1024sIL', buffer, count. offset) but the buffer size can va

Re: help on packet format for tcp/ip programming

2007-02-08 Thread rattan
On Feb 8, 3:40 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-02-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > struct module pack and unpack will only work for fixed size buffer : > > pack('>1024sIL', buffer, count. offset) but the buffer size can vary > > from one packet to the ne

Re: help on packet format for tcp/ip programming

2007-02-07 Thread Grant Edwards
On 2007-02-08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > struct module pack and unpack will only work for fixed size buffer : > pack('>1024sIL', buffer, count. offset) but the buffer size can vary > from one packet to the next :-( Oh for Pete's sake... struct.pack('>%dsIL' % len(buffer), b

Re: help on packet format for tcp/ip programming

2007-02-07 Thread Gabriel Genellina
En Thu, 08 Feb 2007 00:14:13 -0300, <[EMAIL PROTECTED]> escribió: > On Feb 8, 1:43 am, Bjoern Schliessmann [EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >> > I want a specific packet format for packet exchange between a >> > client server across the network. For example frame format >> >

Re: help on packet format for tcp/ip programming

2007-02-07 Thread Felipe Almeida Lessa
On 7 Feb 2007 19:14:13 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> > struct module pack and unpack will only work for fixed size buffer : > pack('>1024sIL', buffer, count. offset) but the buffer size can vary > from one packet to the next :-( Then send the size of the buffer before the buffer, s

Re: help on packet format for tcp/ip programming

2007-02-07 Thread rattan
On Feb 8, 1:43 am, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > I want a specific packet format for packet exchange between a > > client server across the network. For example frame format > > as a python class could be: > > class Frame: > > def __init__(self, buffer=None, cou

Re: help on packet format for tcp/ip programming

2007-02-07 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > I want a specific packet format for packet exchange between a > client server across the network. For example frame format > as a python class could be: > class Frame: > def __init__(self, buffer=None, count=0, offset=0): > self.buffer = buffer >

help on packet format for tcp/ip programming

2007-02-07 Thread rattan
I want a specific packet format for packet exchange between a client server across the network. For example frame format as a python class could be: class Frame: def __init__(self, buffer=None, count=0, offset=0): self.buffer = buffer self.count = count