WebForm UserControl in IE taking a long time with async events

Discussion in 'ASP .Net Web Controls' started by Trebek, Jul 3, 2003.

  1. Trebek

    Trebek Guest

    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
    Trebek, Jul 3, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig Douthitt via DotNetMonster.com

    Consuming usercontrol events in a webform

    Craig Douthitt via DotNetMonster.com, Feb 2, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    544
    Craig Douthitt via DotNetMonster.com
    Feb 2, 2005
  2. =?Utf-8?B?Sm9l?=

    Wiring events from UserControl in WebForm

    =?Utf-8?B?Sm9l?=, Mar 31, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    355
    =?Utf-8?B?Sm9l?=
    Mar 31, 2006
  3. Jim Langston
    Replies:
    3
    Views:
    620
    Ian Collins
    May 31, 2006
  4. Steven
    Replies:
    0
    Views:
    347
    Steven
    Nov 30, 2005
  5. Jim Cain
    Replies:
    1
    Views:
    196
    Yukihiro Matsumoto
    Jul 18, 2003
Loading...

Share This Page