G
Guest
I have an ASP.NET app that has very slow connect times using TCPClient, or
the Socket class, or even calling a COM object that uses C socket calls on
certain similar XP SP2 boxes.
On those boxes, if another connection is made within a couple seconds, it is
fast. Running the same C# code in a console app connects instantly.
Unplugging the network cable allows localhost connections to be instant (?!).
Running the same ASP.NET app on W2K or another XP Pro SP2 box is instant, so
it comes down to being ASP.NET on XP Pro on certain boxes. I've includes the
test results and programs. The boxes with the problems are laptops. Is it
an ASP.NET config issue? XP SP2 Security issue? Any ideas/help is greatly
appreciated.
Jim W
Test results:
XPPro ASP to Remote server
First took 6 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 4 seconds
Med sleep 2 took 0 seconds
XPPro ASP to Localhost with network connection
First took 6 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 4 seconds
Mec sleep 2 took 4 seconds
XPPro ASP to Localhost unplugged
First took 0 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 0 seconds
Med sleep 2 took 0 seconds
XPPro .NET console app to localhost, or remote
First took 0 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 0 seconds
Med sleep 2 took 0 seconds
W2K Server to local host, or remote
First took 0 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 0 seconds
Med sleep 2 took 0 seconds
Pertinent ASP.NET code behind:
....
private void RunTests_Click(object sender, System.EventArgs e)
{
Output.Text = Tester.RunTests( HostName.Text, "<br>" );
}
Pertinent .NET console app code.
....
static void Main(string[] args)
{
System.Console.WriteLine( SocketTest.Tester.RunTests( args[0], "\n" ) );
}
The tester called by ASP.NET and a .NET console app:
using System;
using System.Net;
using System.Net.Sockets;
namespace SocketTest
{
public class Tester
{
public Tester() {}
public static string RunTests( string server, string eol )
{
string ret = RunTest( server, "First ", eol );
System.Threading.Thread.Sleep( 100 );
ret += RunTest( server, "Short sleep 1", eol );
System.Threading.Thread.Sleep( 100 );
ret += RunTest( server, "Short sleep 2", eol );
System.Threading.Thread.Sleep( 10000 );
ret += RunTest( server, "Long sleep 1", eol );
System.Threading.Thread.Sleep( 5000 );
ret += RunTest( server, "Med sleep 2", eol );
return ret;
}
static string RunTest( string server, string prefix, string eol )
{
DateTime start = DateTime.Now;
TcpClient conn = new TcpClient( server, 80 );
TimeSpan span = DateTime.Now - start;
conn.Close();
return prefix + " took " + span.Seconds + " seconds " + eol;
}
}
}
the Socket class, or even calling a COM object that uses C socket calls on
certain similar XP SP2 boxes.
On those boxes, if another connection is made within a couple seconds, it is
fast. Running the same C# code in a console app connects instantly.
Unplugging the network cable allows localhost connections to be instant (?!).
Running the same ASP.NET app on W2K or another XP Pro SP2 box is instant, so
it comes down to being ASP.NET on XP Pro on certain boxes. I've includes the
test results and programs. The boxes with the problems are laptops. Is it
an ASP.NET config issue? XP SP2 Security issue? Any ideas/help is greatly
appreciated.
Jim W
Test results:
XPPro ASP to Remote server
First took 6 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 4 seconds
Med sleep 2 took 0 seconds
XPPro ASP to Localhost with network connection
First took 6 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 4 seconds
Mec sleep 2 took 4 seconds
XPPro ASP to Localhost unplugged
First took 0 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 0 seconds
Med sleep 2 took 0 seconds
XPPro .NET console app to localhost, or remote
First took 0 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 0 seconds
Med sleep 2 took 0 seconds
W2K Server to local host, or remote
First took 0 seconds
Short sleep 1 took 0 seconds
Short sleep 2 took 0 seconds
Long sleep 1 took 0 seconds
Med sleep 2 took 0 seconds
Pertinent ASP.NET code behind:
....
private void RunTests_Click(object sender, System.EventArgs e)
{
Output.Text = Tester.RunTests( HostName.Text, "<br>" );
}
Pertinent .NET console app code.
....
static void Main(string[] args)
{
System.Console.WriteLine( SocketTest.Tester.RunTests( args[0], "\n" ) );
}
The tester called by ASP.NET and a .NET console app:
using System;
using System.Net;
using System.Net.Sockets;
namespace SocketTest
{
public class Tester
{
public Tester() {}
public static string RunTests( string server, string eol )
{
string ret = RunTest( server, "First ", eol );
System.Threading.Thread.Sleep( 100 );
ret += RunTest( server, "Short sleep 1", eol );
System.Threading.Thread.Sleep( 100 );
ret += RunTest( server, "Short sleep 2", eol );
System.Threading.Thread.Sleep( 10000 );
ret += RunTest( server, "Long sleep 1", eol );
System.Threading.Thread.Sleep( 5000 );
ret += RunTest( server, "Med sleep 2", eol );
return ret;
}
static string RunTest( string server, string prefix, string eol )
{
DateTime start = DateTime.Now;
TcpClient conn = new TcpClient( server, 80 );
TimeSpan span = DateTime.Now - start;
conn.Close();
return prefix + " took " + span.Seconds + " seconds " + eol;
}
}
}