Class: Ftpd::DataServerFactory::RandomEphemeralPort

Inherits:
Object
  • Object
show all
Defined in:
lib/ftpd/data_server_factory/random_ephemeral_port.rb

Overview

Factory for creating TCPServer used for passive mode connections. This factory binds to a random ephemeral port.

Instance Method Summary collapse

Constructor Details

#initialize(interface) ⇒ RandomEphemeralPort

Returns a new instance of RandomEphemeralPort.

Parameters:

  • interface (String)

    The IP address of the interface to bind to (e.g. “127.0.0.1”)



13
14
15
# File 'lib/ftpd/data_server_factory/random_ephemeral_port.rb', line 13

def initialize(interface)
  @interface = interface
end

Instance Method Details

#make_tcp_serverTCPServer

Returns:

  • (TCPServer)


18
19
20
# File 'lib/ftpd/data_server_factory/random_ephemeral_port.rb', line 18

def make_tcp_server
  TCPServer.new(@interface, 0)
end