Yes, I have created custom THREAD POOL, and queueing the items there. So I was first wondering the problem was locking issues with my thread pool, so I removed it and checked. It was ok.
This code i posted is not my real Comet Server application code. They are not relevant pieces, I checked. What is important is when new request comes in I somehow keeps or saves some connections in list and close some connections immediately.
I know I compacted the code, IT IS JUST A TEST CASE. It doesn't have to include real ASYNC operation.
And also, today I found some strange thing,
Is it ok to call HttpContext's Resonse.Write on any thread, or I should accumulate all data in async thread and DO THE WRITE operation in Async handler's EndResponse callback method?
And also I am using 2 XMLHttpRequest object on the client side.
1. First one connects to this async handler like /connect/Comet.ashx etc .. So the server will not immediately close this connection but keep it
2. I send short requests on the other one, so server will close it immediately after processing.
My platform is: IIS 7, Vista Home Premium, and also tested on Windows XP PRO and IIS 6.
All the same, third clients 2ND XMLHttpRequest hangs after the first one. I am really wondering why.
Is this Write, Flush operations causing locks, I dont know, It is really hard to find for me. PLEASE HELP, again
I need to finish this very soon,
If you need any other information, please let me know.