The stupid question is the question not asked | |
PerlMonks |
Re^3: deal data transferby John M. Dlugosz (Monsignor) |
on May 18, 2011 at 12:01 UTC ( [id://905464]=note: print w/replies, xml ) | Need Help?? |
Maybe I misunderstood: you are not trying to design or invent a protocol, you are trying to write Perl code that uses a protocol that's already been defined? Knowing when you have read enough data: you start reading what you have thus far. The length is defined by that, somehow. Is the length given first, followed by the data? Or is there a mark at the end? Or perhaps some of each? To check the checksum, look up the protocol specification for the definition of that checksum. There are many ways to formulate such a value. You have to know how they are doing it, to match that. Broken: depends on what you want to do, and perhaps the protocol definition. It might be designed as being intolerant of errors, such as the medical imaging protocols I've worked with. The specification defines what to do in such cases, going into an error state. Or, it might be like recieiving digital TV over the air, where it must be able to resync after an error so you get some static but then continue. The design of the data protocol facilitates this. So, what is the situation, and what are your requirements?
In Section
Seekers of Perl Wisdom
|
|