module Fluent::SocketUtil

Public Class Methods

create_udp_socket(host) click to toggle source
# File lib/fluent/plugin/socket_util.rb, line 21
def create_udp_socket(host)
  require 'ipaddr'

  if IPAddr.new(IPSocket.getaddress(host)).ipv4?
    UDPSocket.new
  else
    UDPSocket.new(Socket::AF_INET6)
  end
end

Private Instance Methods

create_udp_socket(host) click to toggle source
# File lib/fluent/plugin/socket_util.rb, line 21
def create_udp_socket(host)
  require 'ipaddr'

  if IPAddr.new(IPSocket.getaddress(host)).ipv4?
    UDPSocket.new
  else
    UDPSocket.new(Socket::AF_INET6)
  end
end