class Udp2sqsClient::Client

Attributes

host[R]
port[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/udp2sqs_client/client.rb, line 9
def initialize(options = {})
  @host = options.fetch(:host, "localhost")
  @port = options.fetch(:post, 9732)
end

Public Instance Methods

send_message(message) click to toggle source
# File lib/udp2sqs_client/client.rb, line 14
def send_message(message)
  begin
    s = UDPSocket.new
    bytes_sent = s.send(message, 0, host, port)
    bytes_sent == message.bytesize
  rescue SocketError => e
    $stderr.puts "Udp2sqs failed to send : #{e}"
    false
  end
end