Custom ClientInputFilter for POE::Component::Server::TCP
"Michael R. Davis" <[email protected]> Mon, 24 Feb 2014 07:39:21 -0800 (PST)
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
--344044665-1026325798-1393256361=:89467
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
POE Folks,=0AI'd like to use POE::Component::Server::TCP to read data from=
=A0active network sensors but they have a=A0proprietary protocol buffer lik=
e format.=A0 Is there a=A0way to build a ClientInputFilter with multiple fi=
xed length reads building on each other.=0A=A0=0Abyte-type, byte-payload-le=
ngth, payload-of-specified-length=0A=A0=0AAn=A0example=0A=A0=0A"\123\005ABC=
DE"=0A"\124\000"=0A"\125\001A"=0A"\126\007ABCDEFG"=0A=A0=0AThere is no "lin=
e" separator in the protocol.=0A=A0=0AI currently already have a deserializ=
er for each type that I'd like to be able to plug into ClientInput $_[ARG0]=
somehow;=0A=A0=0AIn non-POE I just =0A=A0=0Amy $type=3Dread_byte;=0Amy $le=
ngth=3Dunpack("C", read_byte); =0Amy $payload=3Dread_bytes($length);=0Amy $=
object=3DMy::Object::Factory->new(type=3D>$type, data=3D>$payload);=0A=A0=
=0AAny pointers and help would be appreciated on how to get from here to th=
ere.=0AThanks,=0AMike
--344044665-1026325798-1393256361=:89467
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
<html><body><div style=3D"color:#000; background-color:#fff; font-family:Co=
urier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div>POE =
Folks,</div><div>I'd like to use POE::Component::Server::TCP to read data f=
rom active network sensors but they have a proprietary protocol b=
uffer like format. Is there a way to build a ClientInputFilter w=
ith multiple fixed length reads building on each other.</div><div> </d=
iv><div>byte-type, byte-payload-length, payload-of-specified-length</div><d=
iv> </div><div>An example</div><div> </div><div>"\123\005ABC=
DE"</div><div>"\124\000"</div><div>"\125\001A"</div><div>"\126\007ABCDEFG"<=
/div><div> </div><div>There is no "line" separator in the protocol.</d=
iv><div> </div><div>I currently already have a deserializer for each t=
ype that I'd like to be able to plug into ClientInput <span class=3D"sh_var=
iable">$_</span><span class=3D"sh_symbol">[</span>ARG0<span
class=3D"sh_symbol">] somehow;</span></div><div> </div><div>In non-PO=
E I just </div><div> </div><div>my $type=3Dread_byte;</div><div>my $le=
ngth=3Dunpack("C", read_byte); </div><div>my $payload=3Dread_bytes($length)=
;</div><div>my $object=3DMy::Object::Factory->new(type=3D>$type, data=
=3D>$payload);</div><div> </div><div>Any pointers and help would be=
appreciated on how to get from here to there.</div><div>Thanks,</div><div>=
Mike</div><div> </div><div> </div></div></body></htm=
l>
--344044665-1026325798-1393256361=:89467--