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. 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. Rick Genter

    Delay in SSL socket connection?

    Rick Genter, Nov 7, 2003, in forum: Java
    Replies:
    2
    Views:
    698
  2. Laszlo Nagy
    Replies:
    1
    Views:
    4,858
    Mark Wooding
    Jan 27, 2009
  3. Jean-Paul Calderone
    Replies:
    0
    Views:
    973
    Jean-Paul Calderone
    Jan 27, 2009
  4. Laszlo Nagy
    Replies:
    0
    Views:
    553
    Laszlo Nagy
    Feb 1, 2009
  5. Steve Holden
    Replies:
    0
    Views:
    667
    Steve Holden
    Feb 1, 2009
Loading...

Share This Page