× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



>
>Why does the select() periodically fail?  How can my client truly, TRULY
>determine if more data is available from the server?  Do I need a non-zero
>wait time?  What is a reasonable value?

I don't think select is 'failing' per se.  There just isn't any data
-yet-.  Lost & retransmitted packets by the underlying transport mechanism
could cause this, as another poster mentioned.  A busy network might also
cause select give up before any data is available.

Perhaps I read too much into your message, but I wonder how your actual
protocol is setup.  The receive side of the socket knows how much data to
expect, right?

If you send a fixed length message, your read loop should loop until a
complete message is read, or an error occurs.

If you send a delimited message - e.g. a null byte at the end of each
message, your read loop should read until the null is located, or an error
occurs

Otherwise, you could preface a variable length message with the number of
bytes to follow, and then loop until that many bytes are received, or an
error occurs.

The point is, the receive loop has to *know* how much data to look for.
Also, the loop must be prepared to receive a message in 'chunks' or
'pieces' by comparing the received count with the requested count, and
acting accordingly by requesting to read the remaining data.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.