S
sauly
Hi all!
We are trying to move our exiting application from PocketPC version 4
to version 5. The application is used by sales reps to collect data,
and then upload results via a 56K modem connection to our SQL server.
We use modems because this reduces comms costs and also because of
coverage issues of wireless. Our users do not have PC's or internet
access, just the PDA and a modem/phone line.
Anyway, during this process, the code checks to see if there is a
newer version, and upgrades itself if one is available (ie think a
Code Autoupdate feature). To do this, it uses the WebRequest command
to get a web page which simply has the version number as a string. If
this is different than the current version, it then downloads the CAB
file. The code looks like this, please forgive the poor naming of
variables in places.
Dim Response As WebResponse = Nothing
Dim ResponseStream As Stream
Dim Request As WebRequest
Dim strOnlineVersion As String = ""
Dim sReader As StreamReader
Try
Request = WebRequest.Create(strVersionURL)
Request.Timeout = 60000 ' 60 seconds I believe, should
take no more than 5 or 6
Response = Request.GetResponse ' <<<<<<<< STARTS GRPS
CONNECTION
ResponseStream = Response.GetResponseStream
sReader = New StreamReader(ResponseStream)
strOnlineVersion = sReader.ReadLine
If constVERSION = strOnlineVersion Then
Call myLog("No code update required")
Else
' Update available!
Call myLog("New version (" & strOnlineVersion & ") is
online!")
' Delete an old CAB, if it's there
If File.Exists("\HHBoss.cab") Then
File.Delete("\HHBoss.cab")
End If
' Create asynchronous web request. (Variables declared
elsewhere)
m_req = CType(HttpWebRequest.Create(strUpdateURL),
HttpWebRequest)
m_req.BeginGetResponse(New AsyncCallback(AddressOf
ResponseReceived), Nothing)
End If
Catch ex As UriFormatException
Call myLog("ERROR : Invalid Format. " & ex.Message)
boolCodeSyncError = True
Catch ex As WebException
Call myLog("ERROR : Web Response/Request. " & ex.Message)
boolCodeSyncError = True
Catch ex As Exception
Call myLog("ERROR : General Exception. " & ex.Message)
boolCodeSyncError = True
Finally
If Not Response Is Nothing Then Response.Close()
End Try
This code works fine on PocketPC 2003/2003SE devices, using the
existing modem connection (established prior to the code above, using
RasEntry.Dial). The issue we are having is that with Windows Mobile
5.0 devices, the WebRequest automatically starts a GPRS connection,
even though there is already a modem connection active (which has been
flagged in the connection settings as "This network connects to the
internet" by the way).
This is a real dealbreaker for us, we need this code to work badly. We
want to be able to get the above working without automatically
starting a GPRS connection. Does anyone have any clues or suggestions?
Any help greatly appreciated!!
- Saul
We are trying to move our exiting application from PocketPC version 4
to version 5. The application is used by sales reps to collect data,
and then upload results via a 56K modem connection to our SQL server.
We use modems because this reduces comms costs and also because of
coverage issues of wireless. Our users do not have PC's or internet
access, just the PDA and a modem/phone line.
Anyway, during this process, the code checks to see if there is a
newer version, and upgrades itself if one is available (ie think a
Code Autoupdate feature). To do this, it uses the WebRequest command
to get a web page which simply has the version number as a string. If
this is different than the current version, it then downloads the CAB
file. The code looks like this, please forgive the poor naming of
variables in places.
Dim Response As WebResponse = Nothing
Dim ResponseStream As Stream
Dim Request As WebRequest
Dim strOnlineVersion As String = ""
Dim sReader As StreamReader
Try
Request = WebRequest.Create(strVersionURL)
Request.Timeout = 60000 ' 60 seconds I believe, should
take no more than 5 or 6
Response = Request.GetResponse ' <<<<<<<< STARTS GRPS
CONNECTION
ResponseStream = Response.GetResponseStream
sReader = New StreamReader(ResponseStream)
strOnlineVersion = sReader.ReadLine
If constVERSION = strOnlineVersion Then
Call myLog("No code update required")
Else
' Update available!
Call myLog("New version (" & strOnlineVersion & ") is
online!")
' Delete an old CAB, if it's there
If File.Exists("\HHBoss.cab") Then
File.Delete("\HHBoss.cab")
End If
' Create asynchronous web request. (Variables declared
elsewhere)
m_req = CType(HttpWebRequest.Create(strUpdateURL),
HttpWebRequest)
m_req.BeginGetResponse(New AsyncCallback(AddressOf
ResponseReceived), Nothing)
End If
Catch ex As UriFormatException
Call myLog("ERROR : Invalid Format. " & ex.Message)
boolCodeSyncError = True
Catch ex As WebException
Call myLog("ERROR : Web Response/Request. " & ex.Message)
boolCodeSyncError = True
Catch ex As Exception
Call myLog("ERROR : General Exception. " & ex.Message)
boolCodeSyncError = True
Finally
If Not Response Is Nothing Then Response.Close()
End Try
This code works fine on PocketPC 2003/2003SE devices, using the
existing modem connection (established prior to the code above, using
RasEntry.Dial). The issue we are having is that with Windows Mobile
5.0 devices, the WebRequest automatically starts a GPRS connection,
even though there is already a modem connection active (which has been
flagged in the connection settings as "This network connects to the
internet" by the way).
This is a real dealbreaker for us, we need this code to work badly. We
want to be able to get the above working without automatically
starting a GPRS connection. Does anyone have any clues or suggestions?
Any help greatly appreciated!!
- Saul