Ethernet packet size python

Grant Edwards invalid at invalid
Tue Jan 13 19:23:26 CET 2009

On 2009-01-13, Steve Holden <steve at> wrote:
> K-man wrote:
>> I am sending data using the socket interface in python, but I
>> want to know how big the ethernet packet size is (in bytes).
>> I didn't really see a way using the socket library of how to
>> do this.  Any suggestions?
> There is no way to know what size Ethernet packets will result
> from specific traffic.

Unless he's using a low level API such as AF_PACKET/SOCK_RAW.
If that's the case then the packets will be exactly as big as
he makes them. And he wouldn't be asking this question. :)

> Or do you want to know the MTU size (largest possible Ethernet
> packet size)? This shouldn't really matter, since large TCP
> messages will be split into a sequence of IP datagrams, and
> large IP datagrams will be automatically fragmented and then
> reassembled at the other end.
> Is there a specific reason this is important to you?

If it's just idle curiosity, then wireshark or tcpdump can show
one exactly what's going on on the wire.  A reading of
should also allow one to predict pretty accurately what's going
to happen when you call send().

Grant Edwards                   grante             Yow! I want EARS!  I want
                                  at               two ROUND BLACK EARS
                                 to make me feel warm
                                                   'n secure!!

More information about the Python-list mailing list