working with binary socket data

0 views
Skip to first unread message

bri...@evoserve.com

unread,
May 25, 1999, 3:00:00 AM5/25/99
to
I'm working with data coming in on a socket. It's in binary form, and I
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?

--
Kindly CC replies to bri...@evoserve.com

Brian Baquiran
http://www.evoserve.com/~brianb/


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---

yo...@drexel.edu

unread,
May 25, 1999, 3:00:00 AM5/25/99
to bri...@evoserve.com
In article <7id8dn$4bd$1...@nnrp1.deja.com>,

bri...@evoserve.com wrote:
> I'm working with data coming in on a socket. It's in binary form, and
I
> 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.

Share and Enjoy!
Sean Woods
yo...@drexel.edu

Andreas Kupries

unread,
May 25, 1999, 3:00:00 AM5/25/99
to

yo...@drexel.edu writes:

> In article <7id8dn$4bd$1...@nnrp1.deja.com>,
> bri...@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.ku...@westend.com>
<http://www.westend.com/~kupries/>
-------------------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages