Socket connection delay in asp.net

Discussion in 'ASP .Net' started by Paul, Nov 18, 2004.

  1. Paul

    Paul Guest

    I'm trying to use a socket connection from within an asp.net
    application.
    It works, but somehow opening the socket seems to be extremely slow.
    It finally connects and you can transfer information, but it hangs for
    at least 5 seconds before the connection completes. Interestingly, a
    second connection to the same port in a very short time interval (<1s)
    returns instantly, but if you wait for a couple of seconds a new
    connection again takes very long. The same code in a standalone .net
    application does not show this problem, so it must be something with
    asp.net.

    This is a piece of code in C# that shows this behavour in an asp.net
    application (supposed something is listening on the local computer at
    port 7000)

    Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
    ProtocolType.Tcp);
    IPHostEntry ipHostInfo = Dns.Resolve("localhost");
    IPAddress ipAddress = ipHostInfo.AddressList[0];
    IPEndPoint ipe = new IPEndPoint(ipAddress,7000);
    s.Connect(ipe);

    Any help appreciated!

    Paul
     
    Paul, Nov 18, 2004
    #1
    1. Advertisements

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. Adam Smith

    Dynamic socket connection in asp.net

    Adam Smith, May 26, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    508
    =?Utf-8?B?TGVu?=
    May 26, 2004
  2. Rick Genter

    Delay in SSL socket connection?

    Rick Genter, Nov 7, 2003, in forum: Java
    Replies:
    2
    Views:
    914
  3. Kathryn Bean
    Replies:
    1
    Views:
    800
    John Harrison
    Oct 28, 2004
  4. Replies:
    1
    Views:
    473
    Kevin Spencer
    Jul 12, 2006
  5. Helene Unterwieser
    Replies:
    14
    Views:
    4,293
    Esmond Pitt
    Jul 3, 2007
  6. Dav Tan

    Socket Connection from ASP.NET Page

    Dav Tan, Dec 14, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    563
    Peter Bromberg [C# MVP]
    Dec 14, 2007
  7. Laszlo Nagy
    Replies:
    1
    Views:
    7,191
    Mark Wooding
    Jan 27, 2009
  8. Steve Holden
    Replies:
    1
    Views:
    997
Loading...