Removed async-websocket, more work on netcode

This commit is contained in:
2020-05-08 21:42:14 -05:00
parent e3a2c9abe0
commit bae6a6a332
6 changed files with 60 additions and 35 deletions

View File

@@ -1,8 +1,20 @@
class IMICFPS
module Networking
class Client
attr_reader :uuid,
:packets_sent, :packets_received,
:data_sent, :data_received
def initialize(socket:)
@socket = socket
@write_queue = []
@read_queue = []
@uuid = "not_defined"
@packets_sent = 0
@packets_received = 0
@data_sent = 0
@data_received = 0
end
def read
@@ -11,7 +23,16 @@ class IMICFPS
def write
end
def puts(packet)
@write_queue << packet
end
def gets
@socket.recvfrom_nonblock(Protocol::MAX_PACKET_SIZE)
end
def close
@socket.close if @socket
end
end
end