| Dart Home | PowerTCP Sockets for .NET | Custom Development | Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
| Author | Forum: PowerTCP Sockets for .NET (Secure and Standard) Topic: Connection Slow Down |
| emcgrath emcgrath@ups.com From: New York, NY USA Posts: 5 Member Since: 04/26/05 |
posted January 23, 2008 11:27 AM I am using v1.1.0.3 of Sockets for .NET in VS 2005 under Windows XP. After a client performs about 2000-3000 consecutive connections (client sends data to server tool and receives a response) there is a significant slow down for the client when trying to connect. The time to connect increases from just a few milliseconds to about 5 seconds. Any ideas on what could be causing this? I use the following code in the server: Private Sub TCPServer_Connection(ByVal Sender As Object, ByVal TcpConnection As Dart.PowerTCP.Sockets.ConnectionEventArgs) Handles TCPServer.Connection '*********************************************************************** 'This sub is the Dart Server Tool Receive event. This fires when data 'is received (from an incoming request) by the Dart Server Tool. '*********************************************************************** Dim Found As Boolean = False Dim Response As String = "" Dim Request As String = "" Request = TcpConnection.Tcp.Stream.Read(GS.TerminateCode, 5000, Found) If Found = False Then 'Log error to error file DESLog.Errorlog("???", "", "908", "Invalid Request Transaction - Timed out) Exit Sub End If |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted January 24, 2008 4:45 PM Hi, How many simultaneous clients are connected? What is Server.MaxThreads set to? Are clients disconnected when finished? If there are no available threads, a client cannot connect until there are. Thanks, -ken |
| emcgrath emcgrath@ups.com From: New York, NY USA Posts: 5 Member Since: 04/26/05 |
posted January 24, 2008 5:27 PM No simultaneous clients (only a single client connection at a time), Maxthreads = 25, clients disconnect on their side once they receive a reply from the server. It happens during the client connect phase, the Connection event in the server doesn't fire until about 4-5 seconds pass. This happens after about 2000 - 4000 connects and disconnects in a row. The data being sent by the client is about 1 or 2K, the data being sent back is about 3K. |
K M Drake![]() From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted January 25, 2008 12:01 PM Hi, I was unable to reproduce the problem. For my simple test, I used the unmodified Echo Server sample, and a test application utilizing the code below (form with 2 buttons and a listview). I let it go for about 20,000 connections, and never saw a slow down. Please confirm this works ok for you, then take a look at the server sample code and see if you can spot what you are doing differently. Thanks, -ken private bool stop = true; private void button1_Click(object sender, EventArgs e) { stop = false; int i = 0; button1.Enabled = false; button2.Enabled = true; tcp1.ConnectTimeout = 10000; tcp1.ReceiveTimeout = 10000; do { long now = System.DateTime.Now.Ticks; tcp1.Connect("myServer", 7); now = System.DateTime.Now.Ticks - now; TimeSpan timeSpan = new TimeSpan(now); string[] items = {i.ToString(), timeSpan.Milliseconds.ToString()}; listView1.Items.Add(new ListViewItem(items)); tcp1.Send(System.DateTime.Now.ToString() + ": xxxo"); //actual code had about 1000 x's tcp1.WaitFor("o"); tcp1.Close(new System.Net.Sockets.LingerOption(false, 0)); System.Windows.Forms.Application.DoEvents(); i++; } while (!stop); button1.Enabled = true; button2.Enabled = false; } private void button2_Click(object sender, EventArgs e) { stop = true; } |
| Reply | PowerTCP Sockets for .NET (Secure and Standard) Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|