On Fri, 2005-05-13 at 12:45 +0200, grunch crash wrote:
> Hello!
>
> I use BEEPy 0.5 to write client that connects to a server. I
> investigated exaple clients and wrote my own (similar to
> 'echoclient'). I have following issue with 'reactor'.
>
> Once 'reactor' is started, it takes whole control of a main thread and
> no direct interaction with client is possible. It only does things
> that are defined in profile class (hard-coded) or when channel is
> started (e.g. do something for specified period of time) - when some
> communication event occurs.
> What I need is to create connection to server and call some client's
> method when I need it (I need to interact with my client).
This is more of a twisted issue than a pure BEEPy one, but the gist is
that you need to decide what kind of client interation you need.
Twisted, and thus BEEPy, uses an asynchronous programming model. This
essentially means that you create your client to respond to 'events'
that are detected by the main reactor, which checks for various events
(such as new data arriving on a network socket) and calls an appropriate
action based on that event.
It sounds like you want to be able to do something like send keyboard
input to the remote server when you hit enter, but to display as output
any data received from the remote server whenever it's received.
You would need to add keyboard interaction code that is called as part
of the main reactor loop. This would then trigger the data sending
methods when the user hits enter, for example. There are lots of ways to
do this.
> Is it possible to do this? Looking at 'EchoClient' (not 'echoclient')
> exaple (that I guess works only with BEEPy 0.3 library) I think that
> it was possible and with BEEPy 0.5 is not. Maybe there is a way to
> 'not to use' reactor.
EchoClient is defunct and has been removed from the current codebase.
echoclient is the current code. I think you do actually want to use
reactor, you just need to wrap your mind around how this affects your
code.
That said, it's a good idea for an example, since this is a pretty
common programming task. I'll look into adding an example keyboard
interactive program.
--
Justin Warren <dae...@ei...>
|