SendHTTPData() and ReceiveHTTPData() function
Posted: Wed Dec 12, 2007 9:19 am
Hi there,
After many discussions of people who like to send data or files using the network functions, I recommend some additional functions:
SendHTTPData(ContentPointer.l, ContentLength.l)
and
ReceiveHTTPData(ResultPointer.l {, TimeoutSeconds.l))
The feature of this functions will be the usage of HTTP to ensure the complete transfer.
Internally, this function will create a HTTP-type of message:
The corresponding ReceiveHTTPData() function may parse this information and ensures complete transfer until returning to normal program flow.
The ReceiveHTTPData() function will work in two ways. The first call with a pointer 0 will return the needed size for retrieving the data (header information). A call with a valid pointer starts the receiving process. The optional TimeoutSeconds parameter will give better control about cancelled connections or other failure.
Just an idea...
Kukulkan
After many discussions of people who like to send data or files using the network functions, I recommend some additional functions:
SendHTTPData(ContentPointer.l, ContentLength.l)
and
ReceiveHTTPData(ResultPointer.l {, TimeoutSeconds.l))
The feature of this functions will be the usage of HTTP to ensure the complete transfer.
Internally, this function will create a HTTP-type of message:
Code: Select all
Content-Length: 438
Content-Type: application/zip;
Content-Transfer-Encoding: base64
[Data begins here...]
Code: Select all
; sending:
Content.s = "Hi, this is the message to transfer"
SendHTTPData(@Content.s, Len(Content.s)
; receiving
Size.l = ReceiveHTTPData(0)
If Size.l > 0
Content.s = Space(Size.l)
Success.l = ReceiveHTTPData(@Content.s, 60)
EndIf
Just an idea...
Kukulkan