1
是否有预先定义的红宝石套接字类的函数,这将允许我记录发送和接收的时间消息?红宝石套接字查找发送和接收消息的时间
此刻我正在发送或接收消息,然后立即记录时间。虽然这是工作,我想知道如果有人知道更好的方法?
以下是我现在的做法。这是基于我必须编写的ClientTCP类。服务器以类似的方式布置。
def send_mess
@n.times do
@client.print(@message)
@sent_time_arr << (Time.now.to_f)
sleep(1/@freq)
end
@client.close
return @sent_time_arr
end
您可以提供任何帮助,将不胜感激