Class: SteamCondenser::Servers::Sockets::MasterServerSocket

Inherits:
Object
  • Object
show all
Includes:
Logging, BaseSocket
Defined in:
lib/steam-condenser/servers/sockets/master_server_socket.rb

Overview

This class represents a socket used to communicate with master servers

Author:

  • Sebastian Staudt

Instance Method Summary collapse

Methods included from Logging

formatter=, included, level=, #log, logdev=

Methods included from BaseSocket

#close, #initialize, #receive_packet, #send, timeout=

Instance Method Details

#replyBasePacket

Reads a single packet from the socket

Returns:

  • (BasePacket)

    The packet replied from the server

Raises:


23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/steam-condenser/servers/sockets/master_server_socket.rb', line 23

def reply
  receive_packet 1500

  unless @buffer.long == 0xFFFFFFFF
    raise SteamCondenser::Error::PacketFormat, 'Master query response has wrong packet header.'
  end

  packet = SteamCondenser::Servers::Packets::SteamPacketFactory.packet_from_data @buffer.get

  log.debug "Got reply of type \"#{packet.class.to_s}\"."

  packet
end