Sha256: f401144a526d279ea9409f97a7791bc3a8a2edecffa520b0ee6e1cfb43149f66
Contents?: true
Size: 761 Bytes
Versions: 6
Compression:
Stored size: 761 Bytes
Contents
module GameMachine module Clients class UdtClient def initialize(server) @host = Settings.servers.send(server).udt.host @port = Settings.servers.send(server).udt.port end def disconnect @socket.close end def connect address = JavaLib::InetSocketAddress.new(@host, @port) @socket = JavaLib::SocketUDT.new(JavaLib::TypeUDT::DATAGRAM) @socket.setBlocking(true) @socket.connect(address) @socket end def send_message(bytes) @socket.send(bytes) end def receive(timeout=0.100) array = Java::byte[4096].new res = @socket.receive(array) JavaLib::Arrays.copy_of_range(array,0,res) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems