Dr. Mu has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to come up with a network server for an attached serial device. Since serial communication is point-to-point, once the server "grabs" the serial device by opening the port, serial access to the device from other programs is blocked. This is a problem, since the device in question is programmable via another program that expects to communicate with it via a serial connection. It would be nice to keep the server running and not have to break its connection to the attached device. So I was thinking that if the server could create a virtual serial port, it could intermediate communication between the real device and another program that connects to it using the virtual device. But I'm not sure this is possible in Perl alone or, if so, how to do it.

Any ideas? (The platform is Windows XP, and I'm using ActivePerl.)

Replies are listed 'Best First'.
Re: Virtual Serial Port
by sgifford (Prior) on Nov 01, 2005 at 20:36 UTC
    Why not have your server leave the port closed most of the time, and only open it when it has an active connection? That way programs on the local machine can use it when no remote users are connected.

    Also, serialserver.pl might help you get started.

      Hmm. You may be onto something there! I could also add a webform, accessible only from localhost through a cgi-type interface, that would break any active connection(s) tying up the port.

      Thanks for the idea! (And also for the code link!)

Re: Virtual Serial Port
by ghenry (Vicar) on Nov 01, 2005 at 23:02 UTC

    There's an serial port example using POE, but it's not quite a server. Should be easy to turn it into a server though.

    There's loads more examples in the cookbook.

    HTH.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!