Good timeout for heartbeating proto using TCP - Java Sockets

Im implementing my own proto in Java, it will use a heartbeat over a TCP connection that I also use to transfer messages and files. For the client I am using blocking socket I/O. So here is how Im planning that will work... I will set the socket timeout for K seconds and make the heartbeat stay sending messages in an interval T, so that T < K. If the timeout expires, looks like the server is offline for the client, or vice-versa. The heartbeat is the server sending a String and the Client answering another. I dont want to waste a lot of bandwidth but with a big timeout the server could be mistaken about the client´s status. What is a good K interval? I am thinking about 40 seconds PS: the strings are 8 letters sent in ISO-8859-1 so its small data
if it's small data, why are you worrying about bandwidth?

以上就是Good timeout for heartbeating proto using TCP - Java Sockets的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏