About Store Forum Documentation Contact



Post Reply 
Getting latency and simulate high latency?
Author Message
SamNainocard Offline
Member

Post: #1
Getting latency and simulate high latency?
Hi everyone, I'm still at Network coding.

I have 2 questions about getting and simulate latency.

1. How can I get latency to server?
Is there a better way then send Latency Checking code to determine.
PHP Code:
ClientSendCheckPing(CS_LATENCYServer);
//...
Server.received(0); // ping-pong 
It seems to overload the server.

2. How can I simulate high latency to server?
I want to test and possibly optimize my network code for 300+ ms to simulate oversea or poor connection.
Is there a better way then increase delay before sending command?
PHP Code:
ServerUpdatePos-=Time.ad();
if (
ServerUpdatePos<=0)
{
   
ServerUpdatePos=0.1f;  // 100 ms?



Thank you in advance.
(This post was last modified: 12-06-2013 06:22 AM by SamNainocard.)
12-06-2013 06:21 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #2
RE: Getting latency and simulate high latency?
I think a good question is: why are your pings overloading the server? I'd guess Esenthel uses 32 byte pings, which would take a LOT to overload even a pc from 1997. Are you trying to ping every frame? If so, you should limit pings to a limited number per second.
12-06-2013 10:08 PM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #3
RE: Getting latency and simulate high latency?
I think it is important to average the ping, I still don't have a ping solution I am happy with, packet loss is also important to measure, but I have no idea how to do that.
12-06-2013 10:41 PM
Find all posts by this user Quote this message in a reply
SamNainocard Offline
Member

Post: #4
RE: Getting latency and simulate high latency?
Well, I'm using wrong words for the 1st question. (I got distracted when posting pfft)
I mean, is there a simpler way to get latency than manually sending and receiving, which is kind of over-used for latency checking.

Thanks again. smile
(This post was last modified: 12-07-2013 03:07 PM by SamNainocard.)
12-07-2013 03:05 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #5
RE: Getting latency and simulate high latency?
(12-06-2013 10:41 PM)Fex Wrote:  I think it is important to average the ping, I still don't have a ping solution I am happy with, packet loss is also important to measure, but I have no idea how to do that.

If you send 100 pings and only get 90 back, you have 10% packet loss. It's really that simple.
If you want a true test of actual effective latency, send the server a message with Time.curTimeMS() in it; when the client gets it back, subtract from the current Time.curTimeMS() value.
12-07-2013 05:07 PM
Find all posts by this user Quote this message in a reply
Fex Offline
Gold Supporter

Post: #6
RE: Getting latency and simulate high latency?
(12-07-2013 05:07 PM)Rubeus Wrote:  
(12-06-2013 10:41 PM)Fex Wrote:  I think it is important to average the ping, I still don't have a ping solution I am happy with, packet loss is also important to measure, but I have no idea how to do that.

If you send 100 pings and only get 90 back, you have 10% packet loss. It's really that simple.
If you want a true test of actual effective latency, send the server a message with Time.curTimeMS() in it; when the client gets it back, subtract from the current Time.curTimeMS() value.

Hmm I use TCP, is there some way to see how many of the TCP packets failed (the message is always returned, but it oculd have taken multiple tries), or would I have to send and received UDP just to see the PL?
12-22-2013 02:19 AM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #7
RE: Getting latency and simulate high latency?
(12-22-2013 02:19 AM)Fex Wrote:  
(12-07-2013 05:07 PM)Rubeus Wrote:  
(12-06-2013 10:41 PM)Fex Wrote:  I think it is important to average the ping, I still don't have a ping solution I am happy with, packet loss is also important to measure, but I have no idea how to do that.

If you send 100 pings and only get 90 back, you have 10% packet loss. It's really that simple.
If you want a true test of actual effective latency, send the server a message with Time.curTimeMS() in it; when the client gets it back, subtract from the current Time.curTimeMS() value.

Hmm I use TCP, is there some way to see how many of the TCP packets failed (the message is always returned, but it oculd have taken multiple tries), or would I have to send and received UDP just to see the PL?

Using TCP, you can assume packet loss by the average latency of the packet. If your returns look something like 10ms 10ms 10ms 30ms 10ms 10ms, you can assume the 30 was a lost packet and had to be resent.
12-23-2013 09:27 AM
Find all posts by this user Quote this message in a reply
Post Reply