Sha256: 7328adc3caa0471a71450f008376bb5202799772297ff7e5693688e4178bd95a
Contents?: true
Size: 502 Bytes
Versions: 1
Compression:
Stored size: 502 Bytes
Contents
require 'easy_sockets' host = ARGV[0] || '127.0.0.1' port = ARGV[1].to_i port = 2500 if port <= 0 opts = { host: host, port: port, timeout: 300, separator: "\r\n", logger: Logger.new(STDOUT), } s = EasySockets::UnixSocket.new(opts) [:INT, :QUIT, :TERM].each do |signal| Signal.trap(signal) do exit end end loop do puts "Please write the message you want to send and hit ENTER, or type Ctrl+c to quit:" msg = gets.chomp s.send_msg(msg) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
easy_sockets-0.1.0 | examples/tcp_socket.rb |