The protocol doesn't give you a direct length, it gives you a few hints 
though. A message looks like
8=FIX.4.3\x019=63\x0135=5\
x0149=DEMO.ZION2_P.FIX\x0156=ABFX\x0134=4\x0152=20150730-18:42:07.013\x0110=130\x01

So we've got a 'tag=value' format with the '\x01' as a delimiter, the first 
tag/value chunk indicates the protocol version, the second indicates the 
character count
from it's end (so the 3 of 35=5) up to the delimiter before the 10=130\x01. 
Then the 10=130 at the end is a checksum of the whole message, up to but 
not including itself.

I calculate those with these methods.
https://bpaste.net/show/31f328cdc145

So there is some data that indicates a length of transmission, I'm just not 
sure how to use that.
On Friday, July 31, 2015 at 10:59:40 AM UTC-6, Guido van Rossum wrote:
>
> Oh, that's usually part of the protocol. How would you tell that you've 
> got the end of the message if you read a sequence of messages from a file? 
> (Note: rhetorical question -- this is meant for you to think about the 
> problem you are having so you can solve it yourself.)
>
> Note that .read(N) reads at least one but at most N bytes, blocking at 
> most once, so maybe you can do something with that.
>
> On Fri, Jul 31, 2015 at 6:40 PM, Wellington Cordeiro <[email protected] 
> <javascript:>> wrote:
>
>> I'm not sure I entirely follow though, if I don't know the size of the 
>> response ahead of time, how will readexactly(N) help me?
>>
>> On Friday, July 31, 2015 at 10:12:29 AM UTC-6, Guido van Rossum wrote:
>>>
>>> Perhaps better to use readexactly(N), which raises EOF instead of 
>>> returning fewer than N bytes if it hits EOF early.
>>>
>>> On Fri, Jul 31, 2015 at 5:02 PM, Victor Stinner <[email protected]> 
>>> wrote:
>>>
>>>> 2015-07-31 6:56 GMT+02:00 Luciano Ramalho <[email protected]>:
>>>> > It seems to me you can't use .read() with no arguments to read data
>>>> > that is not line-oriented and is not the whole transmission either.
>>>> > You must use .read(N), where N is a number of bytes. Then you parse
>>>> > what you get and decide on a suitable value of N for the next read.
>>>> > Rinse and repeat.
>>>>
>>>> Exactly.
>>>>
>>>> Victor
>>>>
>>>
>>>
>>>
>>> -- 
>>> --Guido van Rossum (python.org/~guido)
>>>
>>
>
>
> -- 
> --Guido van Rossum (python.org/~guido)
>

Reply via email to