class Callsigns::TCP

Public Class Methods

goodbye(client) click to toggle source
# File lib/callsigns/tcp.rb, line 26
def self.goodbye(client)
  client.puts "Thanks for using Callsigns by AL0Y. 73 de AL0Y\n\n"
end
greet(client) click to toggle source
# File lib/callsigns/tcp.rb, line 5
def self.greet(client)
  client.puts "\n\nWelcome to [Callsigns by AL0Y]"
  client.puts "This is an interactive server to search information of ham radio operators"
  client.puts "by their callsign [only USA-based], DMR ID or NXDN ID"
  help(client)
end
help(client) click to toggle source
# File lib/callsigns/tcp.rb, line 13
def self.help(client)
  client.puts "\n\nAvilable commands:\n"
  client.puts " Lookup [callsign]     - Gives information about the given callsign"
  client.puts "                         As of now, the callsign must be USA-Based."
  client.puts " DMR [number]          - Gives information about a DMR ID\n "
  client.puts " NXDN [number]         - Gives information about a NXDN ID"
  client.puts " HELP or ?             - Shows this command list"
  client.puts " Version               - Shows the current version for this server"
  client.puts " Bye                   - Disconnect from the Callsigns server and"
  client.puts "                         return to node."

end
main(port) click to toggle source
# File lib/callsigns/tcp.rb, line 66
def self.main(port)
  server = TCPServer.new port.to_i
  loop do
    Thread.start(server.accept) do |client| 
      greet(client)
      menu(client)
      client.close
    end
  end
end
menu(client) click to toggle source