GPRS disconnect immediately

G

Guest

hi , all?

Do you know how to disconnect the GPRS connection immediately when
my http request is done?

I try to set the "keep-alive = false" attribute in http's header or
"connection=close" , not work !

thank your kindly reply!

jerry.
 
N

Neil Cowburn [MVP]

From what I can gather, the connection that is made by the HTTP requests is
a non-exclusive connection. It's hard to tell since the connection is made
by a method implemented in the CLR (namely, EstablishConnectionForUrl). If
the connection is non-exclusive, this means that once the connection is made
it can be shared with any other application that may wish to use the
connection. Since there is no mechanism for determining if another
application is making use of the connection, it cannot be closed
programmatically or it could seriously wreak havoc with some other
application relying on the connection. This seems to be standard behaviour
with Connection Manager, as I came across the very same issue when coding a
managed Connection Manager wrapper.

Interestingly, if you dig into the HttpWebRequest class, there is a private
method called ReleaseConnMgrConnection which calls the underlying Connection
Manager API of the same name. This makes an attempt to release the
connection handle opened by Connection Manager. As I discovered through my
own research, if the connection is non-exclusive, calling the
ReleaseConnMgrConnection will succeed, but the connection will not be
dropped.

--Neil
 
G

Guest

Thank you, Neil.


Neil Cowburn said:
From what I can gather, the connection that is made by the HTTP requests is
a non-exclusive connection. It's hard to tell since the connection is made
by a method implemented in the CLR (namely, EstablishConnectionForUrl). If
the connection is non-exclusive, this means that once the connection is made
it can be shared with any other application that may wish to use the
connection. Since there is no mechanism for determining if another
application is making use of the connection, it cannot be closed
programmatically or it could seriously wreak havoc with some other
application relying on the connection. This seems to be standard behaviour
with Connection Manager, as I came across the very same issue when coding a
managed Connection Manager wrapper.

Interestingly, if you dig into the HttpWebRequest class, there is a private
method called ReleaseConnMgrConnection which calls the underlying Connection
Manager API of the same name. This makes an attempt to release the
connection handle opened by Connection Manager. As I discovered through my
own research, if the connection is non-exclusive, calling the
ReleaseConnMgrConnection will succeed, but the connection will not be
dropped.

--Neil

--
Neil Cowburn, MVP
Co-Founder, OpenNETCF.org

WWW: www.opennetcf.org
 
R

Richard Thombs

We had this exact same issue. Our solution was to use a 3rd party library
from Intelliprog (http://www.intelliprog.com/netcf/ras.html). With this,
you can easily drop any established RAS connections (even the USB active
sync connection if you are not careful!).

It is really cheap too. If you do go down this route, mail me and I'll
send you the code we wrapped around it to avoid hanging up the USB
connection.

Best wishes,

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top