FAQ
Hi,
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?

Search Discussions

  • Steve Holden at Jan 13, 2009 at 3:35 pm

    K-man wrote:
    Hi,
    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. 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?

    regards
    Steve
    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    Holden Web LLC http://www.holdenweb.com/
  • K-man at Jan 13, 2009 at 3:58 pm

    On Jan 13, 10:35?am, Steve Holden wrote:
    K-man wrote:
    Hi,
    ? 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. 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?

    regards
    ?Steve
    --
    Steve Holden ? ? ? ?+1 571 484 6266 ? +1 800 494 3119
    Holden Web LLC ? ? ? ? ? ? ?http://www.holdenweb.com/
    I am trying to determine the actual network link speed.

    From http Tue Jan 13 17:01:25 2009
    From: http (Paul Rubin)
    Date: 13 Jan 2009 08:01:25 -0800
    Subject: Ternary operator and tuple unpacking -- What am I missing ?
    References: <375bac43-d1cc-4d70-91a8-7882619b5750@y1g2000pra.googlegroups.com>
    Message-ID: <7xljtfw5yi.fsf@ruckus.brouhaha.com>

    imageguy <imageguy1206 at gmail.com> writes:
    Using py2.5.4 and entering the following lines in IDLE, I don't really
    understand why I get the result shown in line 8.

    Note the difference between lines 7 and 10 is that 'else' clause
    result enclosed in brackets, however, in line 2, both the 'c,d'
    variables are assign correctly without the brackets being required.
    c,d = n if n is not None else 0,0

    parses as:

    c,d = (n if n is not None else 0), 0

    In the case where n is None, c and d are both set to 0.

    In the case where n is a tuple, c is set to the tuple and d is set to 0.

    Does that help?
  • Grant Edwards at Jan 13, 2009 at 6:23 pm

    On 2009-01-13, Steve Holden 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
    http://en.wikipedia.org/wiki/Transmission_Control_Protocol
    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
    visi.com to make me feel warm
    'n secure!!

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 13, '09 at 3:21p
activeJan 13, '09 at 6:23p
posts4
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase