Obviously....
Sockets (not just on Palm) work like pipes. If you write something at one
end, it will *someday* come out at the other end. Your client timed-out -
but that doesn't mean the server knows about it or the fact that the client
send a new request. These are details that you should work out in your
application level protocol. You have two choices.
(1) add sequence numbers to your request/response messages. This way you can
ignore "old/junk" responses.
(2) Close the connection after each failure - this will make sure you have
flushed
any data on the way. but this is costly.
--
Hari Bhaskaran
"maggie lim" <[EMAIL PROTECTED]> wrote in message
news:40578@palm-dev-forum...
>
> i've a scenario from the palm it will send a message to the server and
wait
> for the reply and the timeout is 10 second. after this timeout i'll
receive
> NULL message. however when the server send the message after that timeout
> period. upon the next submission that message sent after the 10 second was
> received instead of the newest message.
>
> i hope those who understand can help me to solve the problem
>
> eg,
> Send();
> Receive();
> Send();
> Receive();
>
> void Send(char *label)
> {
> int sentBytes, sendBytes;
>
> sendBytes=strlen(label);
> sentBytes=send(mySocket, label, sendBytes, 0);
> if(sentBytes!=sendBytes)
> {
> SetFieldText(MainStatusField, "Error", 79, true);
> }
> SetFieldText(MainStatusField, "Send Complete...", 79, true);
> }
>
>
> void Receive(void)
> {
> int recvBytes, recvdBytes=100;
> int x;
>
> for(x=0;x<80;x++)
> {
> recv_buf[x]=NULL;
> }
> recvBytes=recv(mySocket, recv_buf, recvdBytes, 0);
> if(recvBytes!=recvdBytes)
> {
> FrmCustomAlert (GeneralAlert, recv_buf, NULL, NULL );
> SetFieldText(MainStatusField, " ", 79, true);
> }
> }
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/