RE: async i/o completion routines, threading question
- From: stcheng@xxxxxxxxxxxxxxxxxxxx ("Steven Cheng")
- Date: Thu, 28 Feb 2008 11:25:54 GMT
Hi Mark,
I'll try to answer the questions about .NET network components you
mentioned:
#1 Yes, .NET framework has added an additional layer(like a connection
pool) for each process. Therefore, the WebRequest or other component you
hold is not representing a physical connection, but the underlying
ServicePointManager will help arrange the phyiscal ones(such as reuse
them). Here is a good blog article explain this:
#Understanding System.Net Connection Management and ServicepointManager
http://blogs.msdn.com/adarshk/pages/345411.aspx
For the #2 issue you mentioned, I think it maybe due to the default 2
connection limitation of .NET process. By default, each .NET process will
be limited to establish only two connections to a given remote server.
Thus, in cases(such as in your environment), if the two connection has been
already occupied, the further connection attemp should be pending util one
of them is released. Here is also an article explain this:
#Connection Groups and Connection Limits
http://blogs.msdn.com/mflasko/archive/2005/09/11/463865.aspx
You may try enlarging the value to see whether it helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?TWFyaw==?= <mmodrall@xxxxxxxxxxxxx>
Subject: async i/o completion routines, threading question
Date: Wed, 27 Feb 2008 14:52:00 -0800
using
Hi...
We've tried to implement the jabber xep-0124 http tunneling extension
the HttpListener class on the server side (basically other jabberi/o
conversations get wrapped in an http request, and the connection gets kept
open with 1 request outstanding all the time).
We've also tried to implement a test harness in C# with buckets of async
completions and callback delegates. Looking over the test harness, thereare
some interesting questions I'm scratching my head about:contact
1) Each tester uses System.Net.WebRequest.Create (url) to initiate a
and the BeginGetResponse() method to asynchronously wait for the response.
Request.KeepAlive is set to false. The initial WebRequest.Create(url)takes
a long time (~ 13 seconds) to get a connection to the destination serverbut
subsequent message sends are generally much faster. With KeepAlive set tofrom
false, is the framework keeping the connection open anyway? Is it keeping
some of the info cached? I'm wondering why subsequent
WebRequest.Create(url)s get the request sent so much more quickly than the
initial one.
2) As part of processing the conversation on the tester side, it reads
the response with async completion. When there is no more to read, theagain.
completion function parses the xml returned and loops through the data
returned. As part of processing the return data, new requests can be
initiated. It's in one of these, that things seem to get synchronous
client
There's only 1 part of the conversation that's not initiated from the
side. Usually it's client sends A and expects response B. But in thejabber
authentication phase, client sends credentials and the server respond withis
success, *then* the server asks the client a question (what protocol level
supported). The server's question comes in the next response going to thebe
client.
The conversation looks something like this:
Client connect-> Server
Client <- connid Server
Client login -> Server
Client <- success Server
Client directory request -> Server
Client <- version request Server
Client <- directory listing Server (both in same http response)
Client version resp -> Server
(server has no answer to this, so it waits to timeout).
The thing I'm having trouble figuring out is that double-response. My i/o
completion callback gets both answers and processes the version request
first. This results in sending the version response - which *should* also
asynch, but what I'm seeing is that my callback doesn't go ahead toprocess
the 2nd part of the packet until after the version response call timesout.
It's like I'm only allowed to be processing 1 async completion callback ata
time.
Can anyone shed any light on that?
Thanks
Mark
.
- Follow-Ups:
- References:
- Prev by Date: .NET Compatibility
- Next by Date: RE: Working with 32-bit dll in VS2008 on Vista-64
- Previous by thread: async i/o completion routines, threading question
- Next by thread: RE: async i/o completion routines, threading question
- Index(es):
Relevant Pages
|
Loading