Class: ContentServer::RemoteContentServer

Inherits:
Object
  • Object
show all
Defined in:
lib/content_server/remote_content.rb

Instance Method Summary collapse

Constructor Details

#initialize(dynamic_content_data, port) ⇒ RemoteContentServer

Returns a new instance of RemoteContentServer.



74
75
76
77
78
# File 'lib/content_server/remote_content.rb', line 74

def initialize(dynamic_content_data, port)
  @dynamic_content_data = dynamic_content_data
  @tcp_server = Networking::TCPServer.new(port, method(:content_requested))
  Log.debug3("initialize RemoteContentServer on port:#{port}")
end

Instance Method Details

#content_requested(addr_info, message) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/content_server/remote_content.rb', line 80

def content_requested(addr_info, message)
  # Send response.
  Log.info("Content server received content data request")
  Log.debug1("Sending content data:#{@dynamic_content_data.last_content_data}")
  @tcp_server.send_obj(@dynamic_content_data.last_content_data)
  Log.info('Content server sent content data')
end

#tcp_threadObject



88
89
90
91
# File 'lib/content_server/remote_content.rb', line 88

def tcp_thread
  return @tcp_server.tcp_thread if @tcp_server != nil
  nil
end