Class: EM::FTPD::PassiveSocket

Inherits:
EventMachine::Connection
  • Object
show all
Includes:
BaseSocket, Deferrable
Defined in:
lib/em-ftpd/passive_socket.rb

Overview

An eventmachine module for opening a socket for the client to connect to and send a file

Instance Attribute Summary

Attributes included from BaseSocket

#aborted

Class Method Summary collapse

Methods included from BaseSocket

#abort, #data, #initialize, #on_stream, #receive_data, #unbind

Class Method Details

.get_port(sig) ⇒ Object

return the port the server with signature “sig” is listening on



24
25
26
# File 'lib/em-ftpd/passive_socket.rb', line 24

def self.get_port(sig)
  Socket.unpack_sockaddr_in( EM.get_sockname( sig ) ).first
end

.start(host, control_server) ⇒ Object



11
12
13
14
15
# File 'lib/em-ftpd/passive_socket.rb', line 11

def self.start(host, control_server)
  EventMachine.start_server(host, 0, self) do |conn|
    control_server.datasocket = conn
  end
end

.stop(sig) ⇒ Object

stop the server with signature “sig”



18
19
20
# File 'lib/em-ftpd/passive_socket.rb', line 18

def self.stop(sig)
  EventMachine.stop_server(sig)
end