当前位置: 动力学知识库 > 问答 > 编程问答 >

sockets - ruby script to read data over port 4001

问题描述:

At work, we purchased a package of sensors that count items as they pass down a conveyor belt. The sensors' information is accessible via the following protocol:

XL Series Products use a binary protocol for Ethernet communication.

By default, the protocol is available on port 4001. (This is a

configurable property.)

I'd like to write a ruby script that periodically reads this data, but so far, I haven't even figured out how to access the data.

I played around with telnet and tested a simple client script in ruby, both of which left me pretty much where I started.

Does anyone have any information that could help?

网友答案:

Since it supports Ethernet communication, try to use Socket provided in Ruby Standard Library.

Check :http://www.ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/Socket.html

分享给朋友:
您可能感兴趣的文章:
随机阅读: