Hi Mattias,

You should expect a ping (1/2 the roundtrip) of about 3-5ms on a local network. Over the internet of course it varies greatly, but somewhere between 40ms and 100ms is typical (again, 1/2 the roundtrip).

The discrepency in your measurements is most likely not due to Flash. I've created around 50+ multiplayer games in Flash and haven't encountered that issue.

My guess to the cause of your problem is 1 of 2 things:
1) there is something funky with your network causing slow down
or
2) You are just accidentally doing the calculation wrong or your order of events is a little messed up. Its not uncommon to have several ping requests sent before any are received, and then if you dont have your packets stamped with some id, then you dont know which request the response is to.

Simple test would be the following. Just create a button to run a quck ping test:

Just call the 'sendPing' on button click.

var pingIsOut:Boolean = false;
var timePingSent:Number;
function sendPing() {//call on button click
if (!pingIsOut) {//makes sure only 1 ping is out at a time
 pingIsOut = true;
 sendPingRequestFxn();//make the socket call
 timePingSent = getTimer();
}
}
function pingResponseReceived() {//called when the ping response is received
pingIsOut = false;
var ping:Number = (getTimer()-timePingSent)/2;
trace(ping+" ms");
}


Jobe Makar
http://www.electrotank.com
http://www.electro-server.com
phone: 252-627-8026
mobile: 919-609-0408
fax: 919-341-8104
----- Original Message ----- From: "Mattias Högnäs" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, September 07, 2006 2:41 PM
Subject: [Flashcoders] XMLSocket speed


Hi all.

Im running a speedtest on XMLSocket.
Im using a simple XMLSocket.send and onData I send again and so on.. each time Im adding 1 to a couter and when starttime differs with 10 seconds from currenttime I divide the by 10 (To get median number of calls per second from the 10 seconds I've run the test)... I guess you get the point but I could post the AS if needed.
This test runs great... running on local.

Local I get an extremly low ping, around 0.9, but running the swf from a different computer on the same network I get around 200 (The DOS-ping from these computers to my computer running as server in this case - is still low though).
Ive tried changing to different ports but all give the same ping.
But then I tried on a Macintosh and that ping was a lot lower than on the PCs on the network - this got me thinking if this delay is because of flash handling the socket-connection differently on various enviroments and on local / LAN (?). The C# server I've written uses a simple new Socket() to create the connections with async-stream and I dont think the problem lies there.
local/network.

Any ideas on this?
Has anyone created a XMLSocket-handling server wich runs a lot faster in any language?
And if so, aprox what ping could I expect on a  local network?

/ Mattias
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to