TcpClient hangs for 90 secs when connecting from UserControl running in IE.

  • Thread starter Thread starter Julian Anstes via .NET 247
  • Start date Start date
J

Julian Anstes via .NET 247

I've created a Windows UserControl(System.Windows.Forms.UserControl) that I'm hosting in InternetExplorer. I'm trying to open a Tcp connection from thisUserControl to a server app running on the web server machine.I'm using the TcpClient and TcpListner classes to do this. Thefollowing line of code in my UserControl, however, hangs forabout 90 secs before completing successfully

TcpClient tcpClient = new TcpClient(hostName, port);

The server app reports that the connection is acceptedimmediately, but code still hangs for ages before continuing.The same code executes immediately with a normal Windows exe.

Look forward to your replies

cheers
 
I've created a Windows UserControl (System.Windows.Forms.UserControl) that
I'm hosting in Internet Explorer. I'm trying to open a Tcp connection from
this UserControl to a server app running on the web server machine. I'm
using the TcpClient and TcpListner classes to do this. The following line of
code in my UserControl, however, hangs for about 90 secs before completing
successfully

TcpClient tcpClient = new TcpClient(hostName, port);

The server app reports that the connection is accepted immediately, but code
still hangs for ages before continuing. The same code executes immediately
with a normal Windows exe.
 
Add a call to
ConfigurationSettings.GetConfig("system.net/settings")

before you do any call to the network using the System.Net classes.

This should fix the issue.

--

Thanks

feroze
=============
This posting is offered as-is. It offers no warranties and confers no
rights.

I've created a Windows UserControl (System.Windows.Forms.UserControl) that
I'm hosting in Internet Explorer. I'm trying to open a Tcp connection from
this UserControl to a server app running on the web server machine. I'm
using the TcpClient and TcpListner classes to do this. The following line of
code in my UserControl, however, hangs for about 90 secs before completing
successfully

TcpClient tcpClient = new TcpClient(hostName, port);

The server app reports that the connection is accepted immediately, but code
still hangs for ages before continuing. The same code executes immediately
with a normal Windows exe.

Look forward to your replies

cheers
 
Back
Top