class IO::Endpoint::Wrapper
def build(*arguments, timeout: nil, reuse_address: true, reuse_port: nil, linger: nil, buffered: false)
(**buffered)-
Enable(Boolean) -- or disable Nagle's algorithm for TCP sockets. -
Wait(Boolean) -- for data to be sent before closing the socket. -
Allow(Boolean) -- this port to be bound in multiple processes. -
Allow(Boolean) -- this port to be bound in multiple processes.
def build(*arguments, timeout: nil, reuse_address: true, reuse_port: nil, linger: nil, buffered: false) socket = ::Socket.new(*arguments) # Set the timeout: if timeout set_timeout(socket, timeout) end if reuse_address socket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) end if reuse_port socket.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1) end if linger socket.setsockopt(SOL_SOCKET, SO_LINGER, 1) end if buffered == false set_buffered(socket, buffered) end yield socket if block_given? return socket rescue socket&.close raise end