[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

stopping a drb server

Mark Volkmann

7/17/2005 8:52:00 PM

Should I be able to stop a drb server that ends with

DRb.thread.join

by hitting Ctrl-C?

http://segment7.net/projects/ruby/drb/introdu... says that should work.
It's not working for me.

Maybe there's additional code I need to add to enable that.

--
R. Mark Volkmann
Partner, Object Computing, Inc.


4 Answers

Eric Hodel

7/17/2005 9:03:00 PM

0


On 17 Jul 2005, at 13:52, Mark Volkmann wrote:

> Should I be able to stop a drb server that ends with
>
> DRb.thread.join
>
> by hitting Ctrl-C?
>
> http://se.../projects/ruby/drb/introdu... says that
> should work.
> It's not working for me.
>
> Maybe there's additional code I need to add to enable that.

Shouldn't be...

What platform? Is you DNS working? DRb performs a DNS lookup to
discover your local hostname.

$ cat simple_server.rb
#!/usr/bin/env ruby -w
# simple_service.rb
# A simple DRb service

# load DRb
require 'drb'

# start up the DRb service
DRb.start_service nil, []

# We need the uri of the service to connect a client
puts DRb.uri

# wait for the DRb service to finish before exiting
DRb.thread.join
$ ruby -v simple_server.rb
ruby 1.8.3 (2005-06-17) [powerpc-darwin8.1.0]
druby://kaa.local:58927
^Csimple_server.rb:15:in `join': Interrupt
from simple_server.rb:15
$

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04



Mark Volkmann

7/17/2005 9:52:00 PM

0

On 7/17/05, Eric Hodel <drbrain@segment7.net> wrote:
>
> On 17 Jul 2005, at 13:52, Mark Volkmann wrote:
>
> > Should I be able to stop a drb server that ends with
> >
> > DRb.thread.join
> >
> > by hitting Ctrl-C?
> >
> > http://segment7.net/projects/ruby/drb/introdu... says that
> > should work.
> > It's not working for me.
> >
> > Maybe there's additional code I need to add to enable that.
>
> Shouldn't be...
>
> What platform?

Windows XP

> Is you DNS working? DRb performs a DNS lookup to
> discover your local hostname.

Yes. I verified that by doing a ping from a command prompt on a known
URL. It pinged the correct IP address.

> $ cat simple_server.rb
> #!/usr/bin/env ruby -w
> # simple_service.rb
> # A simple DRb service
>
> # load DRb
> require 'drb'
>
> # start up the DRb service
> DRb.start_service nil, []
>
> # We need the uri of the service to connect a client
> puts DRb.uri
>
> # wait for the DRb service to finish before exiting
> DRb.thread.join
> $ ruby -v simple_server.rb
> ruby 1.8.3 (2005-06-17) [powerpc-darwin8.1.0]
> druby://kaa.local:58927
> ^Csimple_server.rb:15:in `join': Interrupt
> from simple_server.rb:15

I ran your code and was not able to break out with a Ctrl-c.
Could this be a Windows-specific problem?

--
R. Mark Volkmann
Partner, Object Computing, Inc.


Hal E. Fulton

7/17/2005 9:57:00 PM

0

Mark Volkmann wrote:
>
> I ran your code and was not able to break out with a Ctrl-c.
> Could this be a Windows-specific problem?
>

I think it is -- I seem to recall being annoyed by this before.

I believe I ended up starting another thread that would do a 'gets'
or something and then kill the other threads after it saw the user
hit the keyboard.

This may also be problematic if e.g. you first hit some other key
besides enter -- I think that cause(s|d) problems.


Hal



daz

7/18/2005 3:07:00 AM

0


Mark Volkmann wrote:
> On 7/17/05, Eric Hodel wrote:
> >
> > What platform?
>
> Windows XP
>
> [...]
> I ran your code and was not able to break out with a Ctrl-c.
> Could this be a Windows-specific problem?
>
> R. Mark Volkmann


Try Ctrl-Break.

If that doesn't clear it, Ctrl-c now should.

(Ctrl-Break-c and Ctrl-c-Break alternatives often work.)

Can't point you to an explanation, sorry.


daz