TCPClient connect slow only on XP Pro ASP on some boxes

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;
}
}
}
 
B

bruce barker

most likely you proxy server setting don't exclude localhost.

-- bruce (sqlwork.com)

Jim W said:
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;
}
}
}
 
G

Guest

Tx for the reply. I can't find any IIS proxy settings, can you give some
details? I'm not using a proxy in the IE settings. I did try turning the
proxy on, and excluded localhost, and it still is slow.
 
G

Guest

New information. The slow computers have a gigbit network and wireless. If
the network cable is attached, *and* wireless is connected, the connect time
goes from 6 seconds (with just the network) to 27 seconds!
 
A

Andre de Lange

Jim,

We're experiencing (in a somewhat different context) the exactsame problem. We're as clueless as you seem to be. I can'treally relate to the suggestion that your proxy settings mighthave something to do with it, but who knows. Have you made anyprogress towards resolution since you posted your question?

Andre
I have an ASP.NET app that has very slow connect times usingTCPClient, or
the Socket class, or even calling a COM object that uses Csocket calls on
certain similar XP SP2 boxes.

On those boxes, if another connection is made within a coupleseconds, it is
fast. Running the same C# code in a console app connectsinstantly.
Unplugging the network cable allows localhost connections to beinstant (?!).


Running the same ASP.NET app on W2K or another XP Pro SP2 boxis 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 arelaptops. Is it
an ASP.NET config issue? XP SP2 Security issue? Anyideas/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, stringeol )
{
DateTime start = DateTime.Now;
TcpClient conn = new TcpClient( server, 80 );
TimeSpan span = DateTime.Now - start;
conn.Close();

return prefix + " took " + span.Seconds + " seconds " +eol;
}
}
}
User submitted from AEWNET (http://www.aewnet.com/)
 
G

Guest

No, I haven't found a solution. On the production machines, which are not
multihomed, it is not an issue, but it's on my todo list.

I will post if I find a solution. Please post if you find one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top