Author Topic: How to simulate latency and packet loss?  (Read 1737 times)

Rexima

  • Jr. Member
  • **
  • Thank You
  • -Given: 7
  • -Receive: 2
  • Posts: 78
    • View Profile
How to simulate latency and packet loss?
« on: October 21, 2016, 06:49:14 AM »
How can i simulate latency and packet loss in TNet, like in UNet?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: How to simulate latency and packet loss?
« Reply #1 on: October 21, 2016, 07:17:33 PM »
This is a really complicated question. TNet primarily uses TCP. TCP will re-transmit lost packets in order to ensure reliable transmission. So to realistically simulate packet loss using TCP I think you'd need to use a raw socket and mimic the behaviour of TCP. This would then give you control over retransmissions and a nice test bed to work with.

Latency, I think, is slightly easier to simulate, but I can't wrap my head around it at the moment. I don't think a stack + delayed popping would work, but you could try it.

Maybe I'm over-thinking it and there's a far simpler approach, like simulating the *effects* of latency and packet loss without actually simulating latency and packet loss. Who knows :-\

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to simulate latency and packet loss?
« Reply #2 on: October 21, 2016, 08:55:39 PM »
Yeah, as cmifwdll said there is no packetloss with TCP. You will never lose packets with TNet's primary means of communication.

Easiest way to simulate latency is to put a testing TNServer on a server somewhere on the other side of the world, such as Australia. :) As real (and as simple) as it gets!