I'm not sure why HttpConnection limits the amount of received data b/c a
MemPtr can be up to 64k and NetLibReceive can read in up to 64k bytes. I'm
also not familiar with HttpConnection. I'd look at the code though that
calls NetLibReceive. If you can change it I would read the data in in a
loop. Allocate some fixed sized buffer, say 1024 bytes, call NetLibReceive,
copy the bytes over from the buffer to an open FileHand or a MemPtr of size
content-length allocated with MemPtrGlueNew and repeat until content-length
bytes are read.

For an example of how to structure (very rough sketch)

// bytes is the number of bytes you need to read
// FileHand is an open handle to a File
ReceiveToOpenFileHand(UInt16 bytes, FileHand hand) {
    Char* bufP = MemPtrNew(1024);
    UInt16 bytesRec = 0;
    Err err;

    while(bytes > 0) {
        if(bytes > 1024) {
            bytesRec = NetLibReceive(gNetLibRef, gSocket, bufp, 1024, ...,
..., ..., ...);
            bytes = bytes - bytesRec;
        }
        else {
             bytesRec = NetLibReceive(gNetLibRef, gSocket, bufp, bytes, ...,
..., ..., ...);
             bytes = bytes - bytesRec;
        }
        FileWrite(hand, bufP, 1, bytesRec, &errr);

    }
    MemPtrFree(bufP);
}

Hope that helps...

On 1/28/07, wini <[EMAIL PROTECTED]> wrote:
>
> Hello!
> The sample code of Http Connection(AppNetLibTest) using NetLibrary, able
> to connect to the internet. When I request any web page from sites yahoo or
> google ,it retrieve the text and tags of that page (HTML tags )only when the
> size of that page is less than 32KB . Which is not in the case when I ask
> for msn.com But getting error "The received data is greater than 32KB" ,
> How to over come this problem? How would I break the recieved page data, if
> it is more than 32KB and display the whole page text and tags when the
> recieved data is more than 32KB.
> --
> For information on using the PalmSource Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/
>

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to