solution.
Add this line of code before your connect method call. It
loads up some config file that the code behind the scenes
needs that causes the delay when the config file is loaded
behind the scenes.
int temp = ServicePointManager.DefaultConnectionLimit;
-----Original Message-----
I am building a client server communications application,
and I need
to use sockets to provide the actual communications
channel. I have
coded the server and client, and from what I can see they
are both
working correctly.
I had to create an ActiveX user control was because the
client would
eventually be running in Internet Explorer from an object
tag on a
ASP.NET page. Then a decision was made to download
the .NET framework
to every client, so it was determined that this component
needed to be
recreated in .NET. That is when I came up with the class
library.
The ActiveX user control, which is using Winsock, works
correctly in a
VB 6 windows application and in an ASP.NET page. When I
run the .NET
client (it is a class library) from inside a .NET windows
application
everything works correctly, however, when I run it from
and ASP.NET
page, or even and HTML page almost everything works. WhenI try to
connect to the server is when I have problems. The first
time I
navigate to the page and the connect code executes; the
browser seems
to lock up for around 1-2 minutes. However, if I am
tracing the
server I see that the server accepts the connection and
returns
control back to the client as fast as the windows
application version.
So the delay occurs after the connection to the server
has already
been made. I have tried to recode this several ways and
they all give
the same result.
Here are the ways I have tried.
Inheriting from TcpClient, and executing Connect().
Instantiating an instance of TcpClient and executing
Connect() on that
instance.
Inheriting from Socket and executing Connect().
Instantiating an instance of Socket and executing Connect
() on that
instance.
Instantiating an instance of Socket and executing
BeginConnect() on
that instance.
I am just about out of ideas, if not completely out, so
any help would
be appreciated.
.