views:

13

answers:

0

I'm writing a little proxy server, and I'm trying to debug a problem. If I refresh the browser twice quickly, my proxy throws an exception, usually with no stack trace or indication of where the problem is. I have a hunch it has to do with a socket being closed prematurely by the browser, or being used for two different requests in my proxy. If I enable network tracing in my app, I get output that looks like

System.Net.Sockets Verbose: 0 : [6992] Exiting Socket#39785641::BeginAccept()   -> AcceptAsyncResult#45523402

However, enabling tracing also causes the app to run slower, which makes the problem condition disappear. I'm wondering if there's a way to get the [6992] number and teh #39785641 from my code, rather than enabling tracing.