Created
December 20, 2016 01:51
-
-
Save kumekay/7bd87f072cbb5411faa847031d9ae81e to your computer and use it in GitHub Desktop.
Apas test client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
server = TCPSocket.open(ENV.fetch('APAS_TCP_SERVER', 'localhost'), | |
ENV.fetch('APAS_TCP_PORT', '4040')) | |
ready = server.gets(5) | |
puts ready | |
loop do | |
msg = rand > 0.1 ? "AT_pour_amb=#{100 + rand(200).to_i};" : 'AT_bottle_changed=1;' | |
server.print(msg) | |
puts msg | |
sleep rand(10) | |
end | |
server.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment