lib/polyphony/net.rb
# Creates a listening `Socket` instance.
#
# @param host [String] hostname
# @param port [Integer] port number
# @param opts [Hash] connection options
# @return [Socket] listening socket
Creates a listening `Socket` instance.
Creates a listening ` Socket ` instance .
def listening_socket_from_options(host, port, opts)
        ::Socket.new(:INET, :STREAM).tap do |s|
          s.reuse_addr if opts[:reuse_addr]
          s.dont_linger if opts[:dont_linger]
          s.reuse_port if opts[:reuse_port]
          addr = ::Socket.sockaddr_in(port, host)
          s.bind(addr)
          s.listen(opts[:backlog] || Socket::SOMAXCONN)
        end
      end
def listening_socket_from_options ( host , port , opts ) :: Socket . new ( :INET , :STREAM ) . tap do | s | s . reuse_addr if opts [ :reuse_addr ] s . dont_linger if opts [ :dont_linger ] s . reuse_port if opts [ :reuse_port ] addr = :: Socket . sockaddr_in ( port , host ) s . bind ( addr ) s . listen ( opts [ :backlog ] || Socket :: SOMAXCONN ) end end
Creates a listening `Socket` instance.
Creates a listening ` Socket ` instance .
None
Socket
host
None
port
None
opts
None