Can Perl do this task???

Discussion in 'Perl Misc' started by at, Feb 21, 2004.

  1. at

    at Guest

    Unix system: I have a compiled application that can only use STDIO
    but I now need it to talk to a remote server using TCP on a particular

    I've tried some hardware type interfaces in between but its difficult
    if not impossible to control the port assignments.

    I was thinking that I could create a perl program and via a pipe
    connect it to my compiled application and the perl program could use a
    module like Sockets::IO to connect to and pass the IO through both
    ways. Sometimes the traffic is incoming and sometimes its outgoing.

    Am I crazy or would this be possible and viable? Any other
    suggestions also appreciated.

    at, Feb 21, 2004
    1. Advertisements

  2. at

    Ben Morrow Guest

    ITYM stdin/stdout?
    This is perfectly possible, indeed relatively trivial... unless you want
    to go for maximum performance.

    A simpler way of doing it is with netcat or socat.

    Ben Morrow, Feb 21, 2004
    1. Advertisements

  3. at

    toylet Guest

    Unix system: I have a compiled application that can only use STDIO
    I think it's doable. What's really holding you from doing a test?
    toylet, Feb 21, 2004
  4. at

    thumb_42 Guest

    It's viable and possible too, just look at what rsh/ssh do. :)

    Speaking of which, why not just use ssh?

    thumb_42, Feb 21, 2004
  5. Try reading `perldoc perlipc` to see if what you want to do is listed in
    there. It *seems* like you're over complicating something simple -or- I'm
    missing something rather complex :)

    You could, maybe, use two fifo's. One for writing and one for reading.
    Both the script and the application could use these fifo's to communicate.
    There is a section in perlipc that covers fifo's, as well as some other
    tactics to deal with this situation.



    Copyright notice: all code written by the author in this post is
    released under the GPL.
    for more information.

    a fortune quote ...
    Innovation is hard to schedule. -- Dan Fylstra
    James Willmore, Feb 22, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.