Class: EtherPing::Server

Inherits:
Object
  • Object
show all
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

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

#runObject



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