Originally Posted by ghostwhowalks
The problem with this is, when I return from epoll_wait in the parent process and I write some thing to master file descriptor, it appears back in the data read from master file descriptor along with the data written by the application executed from child process. Why is it so? Can anybody explain it please?
A pty acts pretty much like a tty. You type a character on the keyboard. Then one appears on the screen. You send a character down the master pty, and you'll get one back. If you don't want this, you'll have to turn off the echo.
If you like, you can examine a sample program of mine which uses a pty to execute telnet and ftp commands to get mail from a shell account I have somewhere. You'll notice that it turns off the echo. The program is here
. I anticipate leaving it there for at least two weeks. Download and play with it if you wish.
Hope this helps.