Making a pipe or socket look like a file.
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file?
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special" On Jun 30, 2009, at 21:42, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file? _______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
J. R. Mauro wrote:
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special"
FIFOs do exist in the filesystem (see mkfifo(3)), but they're only unidirectional. If you want bidirectional, either need a pair of FIFOs, or as a bit of a hack, you could have your external process open up a unix socket and write the fd number and it's PID into some pre-arranged file (say, /tmp/<username>/eagle/socket_location). Your script could then open that file, and use the information to construct a path to /proc/<PID>/fd/<fd> and access the socket as a file that way. Or, I suppose you could simplify the script side by making that pre-arranged file into a symlink to /proc/<PID>/fd/<fd>. Scott
On Tuesday 30 June 2009 21:47:18 J. R. Mauro wrote: please dont top post
On Jun 30, 2009, at 21:42, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file?
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special"
i imagine you could use netcat to redirect from a named pipe so that you can read/write via the network ... seems to work for me $ mkfifo fifo shell 1: $ nc -l -p 12345 localhost > fifo shell 2: $ cat fifo shell 3: $ nc localhost 12345 -mike
On Jun 30, 2009, at 22:24, Mike Frysinger <vapier@gentoo.org> wrote:
On Tuesday 30 June 2009 21:47:18 J. R. Mauro wrote:
please dont top post
Who did?
On Jun 30, 2009, at 21:42, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file?
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special"
i imagine you could use netcat to redirect from a named pipe so that you can
FIFOs are kind of a hack. Make a fuse filesystem in 20 lines of python and you get something more robust and specialized, plus network transparency for free
read/write via the network ... seems to work for me
$ mkfifo fifo shell 1: $ nc -l -p 12345 localhost > fifo shell 2: $ cat fifo shell 3: $ nc localhost 12345 -mike
I'm thinking fuse might work. I'l look into working with fuse in python when I get to a real computer. Thanks! On Jun 30, 2009, at 10:35 PM, "J. R. Mauro" <jrm8005@gmail.com> wrote:
On Jun 30, 2009, at 22:24, Mike Frysinger <vapier@gentoo.org> wrote:
On Tuesday 30 June 2009 21:47:18 J. R. Mauro wrote:
please dont top post
Who did?
On Jun 30, 2009, at 21:42, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file?
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special"
i imagine you could use netcat to redirect from a named pipe so that you can
FIFOs are kind of a hack. Make a fuse filesystem in 20 lines of python and you get something more robust and specialized, plus network transparency for free
read/write via the network ... seems to work for me
$ mkfifo fifo shell 1: $ nc -l -p 12345 localhost > fifo shell 2: $ cat fifo shell 3: $ nc localhost 12345 -mike
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
On Jun 30, 2009, at 22:47, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm thinking fuse might work. I'l look into working with fuse in
It's dead simple, even in C. And then you can have a bunch of files for specific tasks
python when I get to a real computer. Thanks!
On Jun 30, 2009, at 10:35 PM, "J. R. Mauro" <jrm8005@gmail.com> wrote:
On Jun 30, 2009, at 22:24, Mike Frysinger <vapier@gentoo.org> wrote:
On Tuesday 30 June 2009 21:47:18 J. R. Mauro wrote:
please dont top post
Who did?
On Jun 30, 2009, at 21:42, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file?
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special"
i imagine you could use netcat to redirect from a named pipe so that you can
FIFOs are kind of a hack. Make a fuse filesystem in 20 lines of python and you get something more robust and specialized, plus network transparency for free
read/write via the network ... seems to work for me
$ mkfifo fifo shell 1: $ nc -l -p 12345 localhost > fifo shell 2: $ cat fifo shell 3: $ nc localhost 12345 -mike
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
On Tuesday 30 June 2009 22:35:44 J. R. Mauro wrote:
On Jun 30, 2009, at 22:24, Mike Frysinger wrote:
On Tuesday 30 June 2009 21:47:18 J. R. Mauro wrote:
please dont top post
Who did?
i'm guessing you made this comment ironically
On Jun 30, 2009, at 21:42, Alex Camilo <alex.camilo@gmail.com> wrote:
I'm trying to extend the functionality of a piece of CAD software i'm using. The software package is called eagle and it has a custom in application scripting language that allows you to access an open CAD document by manipulating a tree of objects. The scripting language is fairly limited when it comes to talking to the outside world and only offers rudimentary file IO. I was wondering if any of you know how to make one end of a unix socket look like a file?
Unfortunately, you can't. It's one of the design flaws of Unix. You might be able to wrap it with a FUSE filesystem. But sockets and FIFOs are unfortunately "special"
i imagine you could use netcat to redirect from a named pipe so that you can
FIFOs are kind of a hack.
no one said otherwise. the fun thing about *nix is you can leverage these kind of hacks quickly.
Make a fuse filesystem in 20 lines of python and you get something more robust and specialized, plus network transparency for free
if you say so, i havent done fuse work myself -mike
Alex> I'm trying to extend the functionality of a piece of CAD Alex> software i'm using. The software package is called eagle and it Alex> has a custom in application scripting language that allows you Alex> to access an open CAD document by manipulating a tree of Alex> objects. The scripting language is fairly limited when it comes Alex> to talking to the outside world and only offers rudimentary file Alex> IO. I was wondering if any of you know how to make one end of a Alex> unix socket look like a file? What exactly are you trying to achive here with eagle's rudimentary file IO? Do you want to feed Eagle a design in realtime from the socket? Or be able to send data to/from the app from another host? What? I've read the suggestions, and they all have some merit, but I'm still at a loss to understand what you're trying to accomplish. Once we know that, maybe we can suggest a better solution than sockets. John
participants (5)
-
Alex Camilo
-
J. R. Mauro
-
John Stoffel
-
Mike Frysinger
-
Scott Venier