[Tutor] reading an input stream
richard kappler
richkappler at gmail.com
Thu Jan 7 12:14:58 EST 2016
On Thu, Jan 7, 2016 at 12:07 PM, James Chapman <james at uplinkzero.com> wrote:
> Ah yes, OK.
>
> STX and ETX are control characters as you've probably worked out. Are
> there other control characters? Ideally you should have some kind of
> message header with the size of the data to be received. You'd then know
> how big the receiving buffer needs to be rather than having a fixed and
> presumably maximum size of incoming message buffer size.
>
no message header, that would make things too easy, just, as you say below,
\x02
<?xml version="1.0" encoding="utf-8"?>
<foo>
<bar></bar>
</foo>
\x03
>
> From an architectural POV I'd have a few listener threads that upon
> receipt would spawn (or take from a pool is a better approach) a worker
> thread to process the received data.
>
That's the plan, if I'm understanding you correctly. We've brainstormed the
threading, haven't written any of it yet.
>
> Some python snippets that may/may not be of help in my github repo here
> <http://t.sidekickopen32.com/e1t/c/5/f18dQhb0S7lC8dDMPbW2n0x6l2B9nMJN7t5XZsd0QKqW3Mybng63BzGHW4X9JQW56dCWrf5cNnfb02?t=https%3A%2F%2Fgithub.com%2FJames-Chapman%2Fpython-code-snippets&si=5087565715079168&pi=8bcff193-2a91-49f6-ef04-f3f411fbcd45>.
> There are unfortunately no raw socket code snippets in there.
>
Thanks, I'll take a look!
>
> I'd be keen to see the raw socket data (stripped of any actual xml content
> and anything other identifying indicators) as I'm assuming there's more
> than just...
>
> \x02
> <?xml version="1.0" encoding="utf-8"?>
> <foo>
> <bar></bar>
> </foo>
> \x03
>
See above.
regards, Richard
More information about the Tutor
mailing list