Write An IPC Program Using Pipe. Process A Accepts A Character String And Process B Inverses The String. Pipe Is Used To Establish Communication Between A and B Processes Using Python or C++. | I'M FROSTY
Make some Money!

What's Hot

recentposts

Write An IPC Program Using Pipe. Process A Accepts A Character String And Process B Inverses The String. Pipe Is Used To Establish Communication Between A and B Processes Using Python or C++.

============ In File p1.py For Process P1 ============

import os
wfpath="./p1"
rfpath="./p1"
wp=open(wfpath,'w')
wp.write("hello")
wp.close
rp=open(rfpath,'r')
response=rp.read()
print"Reverse of string from process B : %s"%response

============ In File p2.py For Process P2 ============


import os
rfpath="./p1"
wfpath="./p2"
try:
    os.mkfifo(wfpath)
    os.mkfifo(rfpath)
except OSError:
    pass
rp=open(rfpath,'r')
response=rp.read()
print"String recieved from Process A : %s"%response
s=response
s=s[::-1]
print"Reverse is :%s"%s
rp.close()
wp=open(wfpath,'w')
wp.write(s)
wp.close()
rp.close()

============== OUTPUT ============


[[email protected] ~]$ python processA.py
Reverse of string from process B :

[[email protected] ~]$ python processB.py
String recieved from Process A : hello
Reverse is :olleh
Write An IPC Program Using Pipe. Process A Accepts A Character String And Process B Inverses The String. Pipe Is Used To Establish Communication Between A and B Processes Using Python or C++. Reviewed by Hardik Pandya on 1:03:00 PM Rating: 5

2 comments:

All Rights Reserved by I'M FROSTY © 2014 - 2016
*The Content Is Copyrighted To & May Not Be Copied / Republished.

Contact Form

Name

Email *

Message *

Powered by Blogger.