class IO::Endpoint::Wrapper

def set_buffered(socket, buffered)

def set_buffered(socket, buffered)
	case buffered
	when true
		socket.setsockopt(IPPROTO_TCP, TCP_NODELAY, 0)
	when false
		socket.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1)
	end
rescue Errno::EINVAL
	# On Darwin, sometimes occurs when the connection is not yet fully formed. Empirically, TCP_NODELAY is enabled despite this result.
rescue Errno::EOPNOTSUPP
	# Some platforms may simply not support the operation.
rescue Errno::ENOPROTOOPT
	# It may not be supported by the protocol (e.g. UDP). ¯\_(ツ)_/¯
end