开发者

How can I cast UDP streams in Perl?

My Perl script gets a UDP response that is built out of 2 integers + float numbers. The problem is that the UDP stre开发者_开发问答am is one long stream of bytes.

How do I cast the stream into parameters using Perl?


You can use unpack or Convert::Binary::C.

For more on pack and unpack see perlpacktut - the Pack Tutorial.

With Convert::Binary::C, you pass in a C struct definition, and then you can easily extract the data members from the struct.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜