Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
DaBrodr
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 4
Join Date: Mar 2004
Default Wininet HttpSendRequest over GPRS

Hi

I wondered if anyone has any tips on using Wininet over GPRS. I'm currenct using eVc 4 to write an application that sends data to a web server using the Wininet HttpSendRequest or HttpSendRequestEx Functions. The problem I get is when I try to send more than about 10k of data I get a server timeout using the GPRS connection but everything seems fine when I have the XDAii in the cradle.

Ok so the problem seems to be GPRS being slow and unreliable but I have experimented with sending the data in 1k chunks and the problem comes when trying to end the http request with HttpEndRequest. I have checked the server timeouts on my IIS server and they are all set to 15 minutes.

Does anyone have any clues?
 
juha
Old
#2  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Mar 2004
This is the code I use to do a similar thing with a photo which works quite well
Are you setting the response to nothing?

GPRS is very unreliable but I have managed to send 70k files over it.
==========
Private Function FileUpload(ByVal sURL As String, ByVal sFile As String) As String
On Error GoTo eh

Dim binReader As BinaryReader
Dim byteArray() As Byte

binReader = New BinaryReader(File.OpenRead(sFile))
byteArray = binReader.ReadBytes(binReader.BaseStream.Length)

Dim httpURI As New Uri(sURL & sFile)
Dim httpRequest As HttpWebRequest = httpRequest.Create(httpURI)
httpRequest.Method = "POST"
httpRequest.ContentLength = binReader.BaseStream.Length

Dim httpReqStream As Stream
httpReqStream = httpRequest.GetRequestStream
httpReqStream.Write(byteArray, 0, byteArray.Length)
httpReqStream.Close()

Dim httpResponse As HttpWebResponse
httpResponse = httpRequest.GetResponse

Dim sResponse As String
sResponse = CStr(httpResponse.StatusDescription)
FileUpload = "OK"
httpResponse.Close()

binReader.Close()
httpURI = Nothing
httpRequest = Nothing
httpReqStream = Nothing
binReader = Nothing
httpResponse = Nothing
byteArray = Nothing

Exit Function

eh:
MsgBox(Err.Description)
binReader.Close()
FileUpload = "ERROR"
httpURI = Nothing
httpRequest = Nothing
httpReqStream = Nothing
binReader = Nothing
httpResponse = Nothing
End Function
===================
Juha
 
DaBrodr
Old
#3  
Junior Member - OP
Thanks Meter 0
Posts: 4
Join Date: Mar 2004
My code seems to be fine as when I used my mates Vodafone sim in the Xda ii I was able to send a 40k file straight away. It seems there is a limit somewhere around the 8-9k mark in the O2 gprs apn. I have to now get on to 02 and find out how they will let me send more than 8k at a time.
 
juha
Old
#4  
Junior Member
Thanks Meter 0
Posts: 2
Join Date: Mar 2004
There is a problem with O2. They had to give me a new username and password to log onto their network, which has different privileges, to get around it.

Good Luck
Juha
 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

report this ad
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...