I'm trying to testing a server performance, while the number of users increse, for a CVE system by using OpenSimulator. I thought to send, while bots moving in the CVE, a request to the Server and get its response time. I'm trying to do it with code below:
using System;
using System.Net;
namespace Request
{
class MainClass
{
public static void Main(string[] args)
{
WebRequest req = HttpWebRequest.Create("http://externalip:9000/");
try
{
// get the time of a sync request
var watch = System.Diagnostics.Stopwatch.StartNew();
WebResponse response = req.GetResponse();
watch.Stop();
var elapsedMs = watch.ElapsedMilliseconds;
//
long len = response.ContentLength;
if (len <= 0)
{
Console.WriteLine("ERROR: Got length {0} for {1} {2}", len, req.Method, req.RequestUri);
}
else
{
Console.WriteLine("Got length {0} for {1} {2}", len, req.Method, req.RequestUri);
}
}
catch (WebException e)
{
Console.WriteLine("ERROR: Got {0} on {1} {2}", e.Status, req.Method, req.RequestUri);
}
}
}
}
But i noticed that it work only with request to a specific resource. So I thought two possibility:
-
Find a uri to request a resource, like a texture
-
Find a way to send a generic request to the server
How can i implement one of these solutions? Any other suggestions?
Aucun commentaire:
Enregistrer un commentaire