如何在红宝石中执行TOS/DSCP? [英] How to do TOS/DSCP in ruby?
本文介绍了如何在红宝石中执行TOS/DSCP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置 TOS标志/
How does one set the TOS flags/DSCP flags in Ruby on a UDP/TCP stream (preferably using the Ruby/Sockets library)?
推荐答案
You can set the TOS flags with Socket.setsockopt passing IPPROTO_IP
as the level, IP_TOS
as the name of the option, and your desired value:
require 'socket'
s = TCPSocket.new('example.com', 80)
s.setsockopt(Socket::IPPROTO_IP, Socket::IP_TOS, YOUR_TOS_VAL)
这篇关于如何在红宝石中执行TOS/DSCP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文