realbasic-nug
[Top] [All Lists]

Re: Nonblocking StdIn?

To: realbasic-nug at lists dot realsoftware dot com
Subject: Re: Nonblocking StdIn?
From: "Theodore H. Smith" <delete at elfdata dot com>
Date: Tue, 31 Jan 2006 22:33:43 +0000
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20060131220844 dot D19C110A6CAA at lists dot realsoftware dot com>
From: jon pipitone <jon dot pipitone at utoronto dot ca>
Date: Tue, 31 Jan 2006 15:31:25 -0500

Hey folks,

I'm currently writing a console application and I'd like to be able to
get input from the user yet not have the application block if there's no
input available.

Why shouldn't it block? What, are you doing some kind of background processing? Wouldn't that be CPU consuming? What if the user wants stdin to block, so that your app doesn't waste CPU doing background processing?

Can't you complete that processing, just after the user does his input? That way it doesn't matter if the app blocks, its done everything it needs to do.

If you tell us what you are doing, that might help.

It just seems to me like you are going against how stdin was designed to be used.

if you want to really do background processing, consider using another console app to do it, one that does not take stdin.

From what I read, there's no way to query StdIn to
discover if there are any characters waiting, and calls to read() and
readline() block.

So, what do others do? The language reference mentions the possibility
of converting stdin to a socket like so:

     Dim Incoming as TCPSocket = Stdin

but I can't seem to retrieve data from the socket's read/readall
methods.  I'm running this all on Windows for the moment.

--
http://elfdata.com/plugin/



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>