Module: TFTP

Defined in:
lib/em-tftp.rb

Defined Under Namespace

Modules: Protocol Classes: ClientDownloader, ClientReceive, ClientSend, ClientUploader, ListeningConnection, ReadOnlyFileServer, Receive, Send, ServerReceive, ServerSend, Transfer, TransferConnection

Constant Summary collapse

Error =
Class.new(Exception)

Class Method Summary collapse

Class Method Details

.ListeningConnection(listener_klass) ⇒ Object



285
286
287
288
289
# File 'lib/em-tftp.rb', line 285

def self.ListeningConnection(listener_klass)
  # create a subclass of ListeningConnection which uses a specific type of listener
  # this is necessary because when opening a socket, EM does not take a connection OBJECT argument, but a connection CLASS
  Class.new(TFTP::ListeningConnection).tap { |c| c.instance_variable_set(:@listener_klass, listener_klass) }
end

.ReadOnlyFileServer(base_dir) ⇒ Object



395
396
397
# File 'lib/em-tftp.rb', line 395

def self.ReadOnlyFileServer(base_dir)
  Class.new(ReadOnlyFileServer).tap { |c| c.instance_variable_set(:@base_dir, base_dir) }
end