Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > System > Networking

    bufsock.py 1.1

    Download button

    No screenshots available
    Downloads: 347  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Dan Stromberg | More programs
    GPL / FREE
    May 2nd, 2006, 20:50 GMT
    ROOT / System / Networking

     Read user reviews (0)  Refer to a friend  Subscribe

    bufsock.py description

    bufsock.py is a python module that makes it a little bit easier to work with sockets.

    bufsock.py is a python module that makes it a little bit easier to work with sockets, and may also make your I/O faster if you're reading and/or writing lots of tiny packets.

    Also, you may find that it makes your network applications more reliable, as the network is allowed to split apart your packets into multiple smaller packets, or aggregate two or more packets into one larger packet, if it decides it needs to do so for reliability or performance.

    So you might do a s.recv expecting to get one line of input, but the network decided to batch together two remote s.send's into one s.recv, for example. But the network usually, but not always, will batch up your packets the way you'd expect - so this can be a difficult problem to track down.

    It supports the following methods:

    read(length) brings in a specific number of bytes.
    readto(char) reads up thru the next occurence of char
    readtomax(char,length) reads up thru the next occurence of char, or length bytes, whichever is less
    set_chunk_len(length) says "do reads and writes in increments of length". The chunk length defaults to 4096. You should make this larger on networks that employ jumbo frames to squeeze out more performance!
    send(buf) writes the bytes in buf.
    flush() is just like stdio's (the C library's) flush function. Call it when you want an output buffer flushed (written immediately).
    shutdown(v) just like for a regular socket, except it flushes first.

    Usage:

    Code snippet:
    sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    sock.connect((hostname,port))
    bs = bufsock.bufsock(sock)
    version = bs.readto('n')
    print version

    Product's homepage

      


    TAGS:

    python module | network sockets | I/O faster | bufsock.py | python | module

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM