Subject: Re: working with binary socket data - DN [1]


Andreas Kupries <a.kupries@westend.com> - 25 May 1999 - comp.lang.tcl

 yoda@drexel.edu writes:

 > In article <7id8dn$4bd$1@nnrp1.deja.com>,
 >   brianb@evoserve.com wrote:
 > > I'm working with data coming in on a socket. It's in binary form, and

 > > can expect values of 0x00 coming in. How do I fconfigure my filehandle
 > > so that Tcl doesn't screw up my data?

 > > Are there any problems I should be aware of?

 > Nah:
 > fconfigure $sock -translation binary -buffering full -buffsize 2048

 > That will eliminate any translation Tcl will try to do, and give you
 > a 2 K buffer/packetsize to tailor as you need. Set -buffering to
 > "none" if you simply want to flush on send and recieve.

 If working under Tcl 8.1 'fconfigure -encoding binary' is required
 too, to avoid internal recoding into UTF-8.

 --
 Sincerely,
     Andreas Kupries <a.kupries@westend.com>
             <http://www.westend.com/~kupries/>;
 -------------------------------------------------------------------------------

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated