Class: UdpRawSocket

Inherits:
RawSocket show all
Defined in:
lib/net/dns/resolver/socks.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from RawSocket

#send

Constructor Details

#initialize(src_addr, src_port, dest_addr, dest_port) ⇒ UdpRawSocket

Returns a new instance of UdpRawSocket.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/net/dns/resolver/socks.rb', line 110

def initialize(src_addr, src_port, dest_addr, dest_port)
  super(src_addr, dest_addr)

  # Check ports
  @src_port  = check_port src_port
  @dest_port = check_port dest_port

  # Total lenght: must be overridden by subclasses
  @tot_lenght = 20 + 8 # 8 bytes => UDP Header

  # Protocol: must be overridden by subclasses
  @protocol = 17 # UDP protocol

  @to = Socket.pack_sockaddr_in @dest_port, @dest_addr.to_s
end