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