MobileVB Socket HTTP Class
Links
Contact Us
Downloads
 

Revision Log:
04/11/05 - fixed error default content-type to work with II6
04/11/05 - created a HexToLong function
04/11/05 - Fixed Error in CheckDecodeMessage function to handle chunked message correctly.
04/11/05 - Fixed POST message concatenation error


Donation
If you feel this code is worth $50, please pay me for my time.  If not, feel free to use it as you see fit.

This is a single class that you can use in place of the AFInetHTTP ingot when the InetLib is not found on your Palm device.  This allows you to still use a Web Server to get connent even if you are using Bluetooth, 802.11b, CDPD, or GPRS.

This class requires you to have a AFClientSocket ingot and an AFTimer Ingot dedicated to this class.

Here is an example:

Option Explicit

Private oHTML As New clsHttpSocket

Private Sub AFTimer2_Timer()
    ' This timer is used to check to status of the Web Request
    If oHTML.StillExecuting Then
        ' Wait until done.
        If oHTML.State = ehsConnecting Then
           lblStatus.Caption = "Connecting..."

        ElseIf oHTML.State = ehsWaitingForData Then
            lblStatus.Caption = "Waiting for reply..."

        ElseIf Not oHTML.State = ehsReceiving Then
           lblStatus.Caption = oHTML.DownloadedBytes & " Bytes"

        ElseIf oHTML.ContentLength > 0 Then
           lblStatus.Caption = oHTML.DownloadedBytes & " of " & oHTML.ContentLength & " Bytes"

        Else
           lblStatus.Caption = oHTML.DownloadedBytes & " Bytes"
        End If
    Else
        txtHTML.Text = oHTML.HTMLDocument
        AFTimer2.Enabled = False
    End If
End Sub

Private Sub cmdGet_Click()
    oHTML.URL = txtURL.Text
    oHTML.Execute
    AFTimer2.Enabled = True
End Sub

Private Sub Form_Load()
    oHTML.UpdateClientSocket AFClientSocket1
    oHTML.UpdateTimer AFTimer1
End Sub

 

The zip file you receive will include a sample form that you can compile into a MobleVB program and run on your palm or pocket pc.

This code has been adapted from code found on the internet.  Since this is the case, it falls under the GPL licenses.