× 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.



Hi Jane,

On 9/18/2013 1:56 AM, Jane Taubman wrote:
I have a second problem if anyone knows a quick answer. The readln()
function waits for data to arrive, but I need to be able to check for data
arriving with out waiting, eg

Please only use the readln() routine as an example to learn from. It is not production-quality code -- it's "dumbed down" code meant to be easy to learn from.

Read the routine... figure out how the recv() API can be used, etc.

Then write your own routine that works the way you want it to work!

1) I would strongly recommend using non-blocking sockets in your example. These do not wait, but return immediately if there's no data to read.

2) The select() or poll() API (personally, I always use selecT()) can be used to check if there's data available to read on a socket, or to wait for data (even on a non-blocking socket) with a timeout.

-SK

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.