Hi,
    The answer is a resounding YES! The ExgSend function can return values other
than 0 or the full count. The fact that the built-in apps are writeen to assume
it's all or nothing is frnakly a bug in the built-in apps.

    Depending on a number of factors, including the possibility of new Exchange
Libraries for new transports, it may be that ExgSend cannot send everything is
one gulp. You should always write your app to assume that ExgSend may need
multiple calls and to keep the event loop running between calls to ExgSend. This
way if everything goes out at once, great. If not then you're ready to send out
the remainder as it becomes possible.

     Cheers,
     Bruce Thompson
     Senior Developer Support Engineer
     Palm Computing, Inc.

--------------------- Original Message -------------------
Date: 4 Nov 1999 18:59:06 -0800
From: Bill Goodman <[EMAIL PROTECTED]>
Subject: ExgSend operation

I am confused about the way that ExgSend works. During normal operations,
can it return values other than 0 or the full count specified in the
"bufLen" parameter? Is the caller supposed to handle these values and
continue sending?

The "IR and the Exchange Manager" knowledgebase article on the Palm web
site seems to say that intermediate values can indeed be returned by
ExgSend. It says:

   "ExgSend will send as many bytes as it can before returning. The
   return value is the number of bytes actually sent. Call repeatedly
   (updating the buffer pointer of course) until all data has been
   sent, or an error occurs."

However, the MemoPad and DateBook source code (from the 3.0 SDK) seem to
assume that ExgSend will transmit all data or fail. Here is the PutString
function they both use:

   static void PutString(const void * exgSocketP, const Char * const stringP)
   {
   ULong len;
   Err err;

   len = ExgSend((ExgSocketPtr) exgSocketP, stringP, StrLen(stringP), &err);

   // If the bytes were not sent throw an error.
   if (len == 0 && StrLen(stringP) > 0)
      ErrThrow(err);
   }

If ExgSend were to return a non-zero value saying it transmitted less than
the full amount, this function would return as if the entire string had
been successfully transmitted. This would produce corrupted data transfers.
[It also seems a bit strange that this function ignores the returned error
unless "len" is zero.]

The description of ExgSend in the Palm OS SDK Reference description does
not shed any light.

Bill Goodman
Cyclos


Reply via email to