GPRS disconnect immediately

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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
 
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.
 
Back
Top