Forum: Ruby A dRuby application running as a Windows service?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5233e77ba84bdc2b4ae88d1cef53e8f0?d=identicon&s=25 dominic.marks (Guest)
on 2005-11-14 16:14
(Received via mailing list)
Hello,

I'm attempting to write a small druby application which will run on our
network of Windows PCs. The application will run in the background and
allow
some methods to be used on the client PCs. This application needs to run
invisibly on the client PCs so I have installed the script as a service
using SRYANY.EXE, I first tried using the win32-service module, and
while I
could install the service properly I could not get it to start.

Now I have the script installed and it will start correctly on the
Windows
PC. Now I try and call a method via druby the client script hangs
indefinitely and the method never appears to return.

This happens even for a trivial 'ping' method, so I know it is not
hanging
in the method I'm calling.

Has anyone had any success in writing a druby application running as a
service on Windows? I've used druby extensively on Windows without
problems
before now, but I've never used it as a service.

My best guess is that for some reason creating the thread when running
as a
service is stalling somewhere, but that is just a guess.

Example dRuby Application:

>
require 'drb/drb'
require 'thread'

class SampleServer
  def ping
    "pong"
  end
end

DRb.start_service("druby://:1234", SampleServer.new)
DRb.thread.join
<

Example dRuby Client:

>
require 'drb/drb'

DRb.start_service
drb = DRbObject.new(nil, "druby://localhost:1234")
puts drb.ping
<

If I run the server and client in console windows on the system,
everything
works as expected. Only when running as a service do the druby calls
hang
when calling the method on the druby server.

Any clues?

Thanks,
E5c79d5a6d378dc4a26e20435be31657?d=identicon&s=25 cribbsj (Guest)
on 2005-11-14 16:38
(Received via mailing list)
Dominic Marks wrote:

>Hello,
>
>I'm attempting to write a small druby application which will run on our
>network of Windows PCs. The application will run in the background and allow
>some methods to be used on the client PCs. This application needs to run
>invisibly on the client PCs so I have installed the script as a service
>using SRYANY.EXE, I first tried using the win32-service module, and while I
>could install the service properly I could not get it to start.
>
>
In the latest version of KirbyBase I just released
(http://netpromi.com/kirbybase_ruby.html), I have an example script of
how to run the server, which is a druby app, as a Windows Service using
win32-service.  I pretty much stole two of Daniel Berger's sample
scripts and changed a few lines of code and it worked.

Daniel would be the one to answer any complex questions about this, but
if you want to see my examples, you can download the KirbyBase
distribution and look in the examples/kbserver_as_win32_service
directory.

HTH,

Jamey

Confidentiality Notice: This email message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and/or privileged information. If you are not the intended
recipient(s), you are hereby notified that any dissemination,
unauthorized review, use, disclosure or distribution of this email and
any materials contained in any attachments is prohibited. If you receive
this message in error, or are not the intended recipient(s), please
immediately notify the sender by email and destroy all copies of the
original message, including attachments.
This topic is locked and can not be replied to.