Hi again.
I've done some testing now and the conclusion is as follows :
1) using the Socket class : 200 ping
2) using the TcpListener and the TcpClient classes : around 20 ping.
So.. Never, ever, ever, ever, use the Socket class in C# if your only
going to use TCP-packets when writing a server for XMLSocket, the
TcpListener is way faster.
Oh and another thing; try not to run the server as a windows app if you
can - that also seem to slow down the send/recieve performance
(strangely enough) - instead allways compile as a console app if
possible (It didnt run well as a service either).
/ Mattias
Mattias,
Yeah, I don't know much about .Net and sockets. I'm sorry about that.
Good luck
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: "Flashcoders mailing list" <[email protected]>
Sent: Thursday, September 07, 2006 5:30 PM
Subject: Re: [Flashcoders] XMLSocket speed
Helo Jobe.
Thanks for the quick response.
I've tried your code and the LAN speed is around 100 ms.
Could it be the way .NET setup the Socket (Im using the Socket class
in C# .NET 2.0) together with flash that makes it slow over LAN?
I will ask the "network-guy" if the router/switch is sniffing packet
or something similar that could create the high ping time.
I'll get back to you if I find anything interesting. :-)
/ Mattias
Jobe Makar skrev:
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
_______________________________________________
[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
_______________________________________________
[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