views:

43

answers:

1

When using CasiniDev fiddler shows a one second TCP-Connect for each connection from a browser. it's always exactly one second maybe few milliseconds up or down, that's why I think it might be a configuration somewhere.

the thing that I can't make any sense out of is when I use System.Net.WebClient.DownloadString() in a loop without fiddler everything is instant, but as soon as I start fiddler the connection time goes to one second.

fiddler has no effect on connection speed from the browser, it takes one second regardless of fiddler or now.

here is some of the code from CasiniDev that I thought might be relevant (Full Class):

public void Start()
        {
            _socket = CreateSocketBindAndListen(AddressFamily.InterNetwork, IPAddress, Port);

            //start the timer
            DecrementRequestCount();

            ThreadPool.QueueUserWorkItem(delegate
                {
                    while (!_shutdownInProgress)
                    {
                        try
                        {
                            Socket acceptedSocket = _socket.Accept();
                            Logger.Info("QueueUserWorkItem");
                            ThreadPool.QueueUserWorkItem(delegate
                                {
                                    if (!_shutdownInProgress)
                                    {
                                        var conn = new Connection(this, acceptedSocket);

                                        if (conn.WaitForRequestBytes() == 0)
                                        {
                                            conn.WriteErrorAndClose(400);
                                            return;
                                        }

                                        Host host = GetHost();

                                        if (host == null)
                                        {
                                            conn.WriteErrorAndClose(500);
                                            return;
                                        }

                                        IncrementRequestCount();
                                        host.ProcessRequest(conn);
                                        Logger.Info("processed.");
                                    }
                                });
                        }
                        catch
                        {
                            Thread.Sleep(100);
                        }
                    }
                });
        }

  private static Socket CreateSocketBindAndListen(AddressFamily family, IPAddress address, int port)
        {
            Socket socket = new Socket(family, SocketType.Stream, ProtocolType.Tcp);
            socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            socket.Bind(new IPEndPoint(address, port));
            socket.Listen((int)SocketOptionName.MaxConnections);
            return socket;
        }
A: 

Duplicate?

http://stackoverflow.com/questions/3476404

Robert Chartier