Class: EtherPing::Server
- Inherits:
-
Object
- Object
- EtherPing::Server
- Defined in:
- lib/ether_ping/server.rb
Overview
Responder for ping utility using raw Ethernet sockets.
Defined Under Namespace
Modules: Connection Classes: ConnectionWrapper
Instance Method Summary collapse
-
#initialize(eth_device, ether_type) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
Constructor Details
#initialize(eth_device, ether_type) ⇒ Server
Returns a new instance of Server.
45 46 47 |
# File 'lib/ether_ping/server.rb', line 45 def initialize(eth_device, ether_type) @socket = Ethernet.raw_socket eth_device, ether_type end |
Instance Method Details
#run ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/ether_ping/server.rb', line 37 def run connection = ConnectionWrapper.new @socket loop do packet = @socket.recv 65536 connection.receive_data packet end end |