I am working on a WAP browser (transfer over UDP) and I am able to receive
data under 1kb, but when the size of the data is more than 1kb the receive
timesout. Receiving data greater than 1kb works fine on the PalmOS simulator
(connection to a server on my LAN) but fails on my Tungsten T3 (connection
via bluetooth through PC to server on LAN).

Below is the code I am using.

Thanks,
Donald

#define DEF_RECEIVE_BUF 4096

len = WspGetReply(g->sock,g->inBuf,DEF_RECEIVE_BUF,maxTimer,g); // retreives
the WAP page
// a bunch of stuff to parse data

do { // this downloads the images. Images less than 1kb download fine but
anything larger fails with a timeout.
       // on the simulator all images download fine.
    len = WspGetReply(sock,imgBuf,DEF_RECEIVE_BUF,maxTimer,g);
}
while(len==0);

Int16 WspGetReply(Int16 sock, char *buf, Int16 buflen, UInt32
maxTimer,GlobalsType *g)
{
    Int16     ret;

    // please don't turn me off now
    EvtResetAutoOffTimer();


for(;;) {
    ret = recv(sock,buf,buflen,0);

    if ((errno==netErrTimeout) && ( TimGetTicks() < maxTimer ) ) {
        return(0);
    }

    if (ret <= 0) {
     g->progress= 0;
     showProgress(g);
        g->state = BS_IDLE
 if (ret == 0) {
         MyErrorFunc2("Could not receive data from server. Connection closed
by remote host.","");
           ret = -1;
        }
        MyErrorFunc2("\nCould not receive data from the
server.\nReason:\n",WspHostErrStr());
        if (errno == ENOMEM) {
         MyErrorFunc2("ENOMEM","");
        }
    } else {
        g->state = BS_WSP_DECODE;
    }

break;
}

    // close socket if needed
    if (sock >= 0)
        close (sock);
    sock = -1;
    return(ret);
}



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

Reply via email to