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

  • Thread starter Julian Anstes via .NET 247
  • 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
 
J

John Saunders

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.
 
F

feroze

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
 

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

Top