Question

Is that possible to achieve Inter process communication using any terminal or serial ports in AIX or Unix?

I would like to achieve this by using commands/scripting only where one process writes a string on terminal and another process reads same terminal and processes that string. I know that using pipe also this is possible but I do not have enough idea on that.

Also is there a way we can determine which all ports/terminals are available in AIX machine? Or is it possible to create new terminal at run time (not the boot time) that will be used by only above two processes?

Was it helpful?

Solution

I think what you want are pty's? Or, another option would be unix domain sockets.

The answer to your first question is "no"... not really. When you write out to a tty, that output is sent out to the real device and not available to be read back.

The list of tty's on a system is: lsdev -Cctty

Creating tty's at run time is possible but not really what you want either. A tty is a child of a serial port and you can not add serial ports arbitrarily. They are real things. With AIX and Power systems, you can add devices while the system is up (hot swap) but that is getting (I'm assuming) way far off your original topic.

The basic different between a pty and a unix domain socket is a pty mimics the output and input process of a real tty in one direction. This is what telnet, rlogin, ssh, and many other daemons use when connections come in. It is easy to make ksh believe that it has a real tty by using pty's. If you don't need that, then they are added trouble that you don't need. Find a link on how to create and use a Unix domain socket and you will have what you need (or a pipe but a pipe requires a parent / child relationship which I assume you do not have).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top