#!/usr/bin/ruby
callsign = "jh1swd"
password = "password"
host = "machine_name"
port = "6300"
require "socket"
require "kconv"
sock = TCPSocket.open(host,port)
sock.print callsign, "\r\n"
sock.print password, "\r\n"
t = Thread.start do
  while line_in = sock.gets
    print Kconv::tojis line_in
  end
  exit
end
while line = $stdin.gets
  line.chop!
  line_out = line.tosjis
  sock.print line_out, "\r\n"
end
t.exit
sock.close

 

callsign password hostの部分は適宜書き換えて下さい。

戻る