Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a99df884c672f8924b9e4af2cbffa5b2980d8190
Ticket: 1665628fffffffffffffffffffffffffffffffff
destructive scan of a ByteArray
User & Date: dgp on 2007-02-22 22:07:12
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    Originator: NO
    
    
    While the observations appear to
    be correct, and we should consider
    addressing what we can...
    
    ...the way to avoid these problems
    is to not use a "buffer" in the
    first place, I think.  Tcl is not
    C and C coding patterns often don't
    map well onto it.
    
    Instead of one huge [read] into a
    "buffer" from which you struggle
    to process things due to some
    limitations and inefficiencies
    of the base commands, why not
    only [read] as many bytes as you
    need at a time to do what you need 
    to do?
    
    binary scan [read $sock 4] I dlen
    binary scan [read $sock $dlen] a* data
    
    I think the availability of this
    simple workaround is why we haven't noticed
    these issues much before.
    
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"