Class: TFTP::TransferConnection
- Inherits:
-
EM::Connection
- Object
- EM::Connection
- TFTP::TransferConnection
- Includes:
- Protocol
- Defined in:
- lib/em-tftp.rb
Overview
UDP socket (really EM::Connection) which is being used for an in-progress transfer
Constant Summary
Constants included from Protocol
Instance Attribute Summary collapse
-
#transfer ⇒ Object
Returns the value of attribute transfer.
Instance Method Summary collapse
Instance Attribute Details
#transfer ⇒ Object
Returns the value of attribute transfer.
351 352 353 |
# File 'lib/em-tftp.rb', line 351 def transfer @transfer end |
Instance Method Details
#receive_data(data) ⇒ Object
353 354 355 356 357 358 359 360 361 362 |
# File 'lib/em-tftp.rb', line 353 def receive_data(data) peer_port, peer_addr = Socket.unpack_sockaddr_in(get_peername) $stderr.puts "Received: #{data} (#{data[0..3].bytes.to_a.join(',')}) from #{peer_addr}:#{peer_port}" if $DEBUG packet = Packet.new(data.encode!(Encoding::BINARY)) if transfer && peer_addr == transfer.peer_addr && (peer_port == transfer.peer_port || transfer.peer_port.nil?) transfer.send(packet.opcode, packet, peer_port) end rescue TFTP::Error transfer.error!($!.) end |