Sha256: 774badf57d3b4b0c3f18dfe6b3c54e7b98d892b1ea1d04c00b77300adcf9f0ee

Contents?: true

Size: 482 Bytes

Versions: 6

Compression:

Stored size: 482 Bytes

Contents

require 'socket'
require "uri"

module GameMachine
  module Clients
    class UdpClient

      def initialize(server)
        @host = Settings.servers.send(server).udp_host
        @port = Settings.servers.send(server).udp_port
        @socket = UDPSocket.new
        @socket.connect(@host,@port)
      end

      def send_message(message)
        @socket.send(message,@host,@port)
      end

      def receive_message
        @socket.recvfrom(1024)[0]
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
game_machine-1.0.4 lib/game_machine/clients/udp_client.rb
game_machine-1.0.2 lib/game_machine/clients/udp_client.rb
game_machine-0.0.11 lib/game_machine/clients/udp_client.rb
game_machine-0.0.10 lib/game_machine/clients/udp_client.rb
game_machine-0.0.9 lib/game_machine/clients/udp_client.rb
game_machine-0.0.8 lib/game_machine/clients/udp_client.rb