WebForm UserControl in IE taking a long time with async events

T

Trebek

Hello all:

I am building an intranet application for use with our company's call center
that allows operators in the call center the ability to communicate with one
another, exchange files, images, etc... via the corp intranet. Very similiar
to a standard chat program, the difference being that this app will
eventually hook into our proprietary call center software (but not yet
fortunately).

I have a server that is very robust and, when I contact it from a Win32 app
using sockets, the performance is excellent. However, this is only in
testing. For production, we need to have a web-based solution. Originally,
this was written in Java using applets and worked fine, but corporate has
standardized all 'new' development on the .NET platform so this is no longer
an option.

Situation: I wrote an example Forms UserControl, hosted it in IE (yes, I
did adjust all the permissions, code grp issues, etc... to get it working)
on a test html page that opens an asynchronous socket connection to the
server. The connection works fine once the 'connect' callback method is
called. It's just that this callback takes around a minute 45 seconds to
callback. Once it calls back, there is no trouble. Send and Receive
callbacks fire quickly... it's just this initial connect callback that is
taking so long. Some sample code below :

private void btnConnect_Click(object sender, System.EventArgs e)

{

try

{


IPHostEntry ipHostInfo = Dns.Resolve(ip);

IPAddress ipAddress = ipHostInfo.AddressList[0];

IPEndPoint localEP = new IPEndPoint(ipAddress, port);


client = new Socket(AddressFamily.InterNetwork,SocketType.Stream,
ProtocolType.Tcp);

connectDone.Reset();

client.BeginConnect(localEP,new AsyncCallback(ConnectCallback), client);

rtbChatMsg.Invoke(new DelWriteMsg(writeMsg),new object[]{"Connecting to
server..."});

connectDone.WaitOne();

}

catch (Exception ex)

{

rtbChatMsg.Invoke(new DelWriteMsg(writeMsg),new object[]{ex.ToString()});

}

}

//And the callback looks like

private void ConnectCallback(IAsyncResult ar)

{


try

{

// Retrieve the socket from the state object.

Socket client = (Socket) ar.AsyncState;

// Complete the connection.

client.EndConnect(ar);


// Signal that the connection has been made.

connectDone.Set();

rtbChatMsg.Invoke(new DelWriteMsg(writeMsg),new object[]{"Connected!"});


}

catch (Exception ex)

{

rtbChatMsg.Invoke(new DelWriteMsg(writeMsg),new object[]{ex.ToString()});


}

}

Anyone have any ideas why this is taking so long on the initial connection?



Thanks All,



Alex
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top