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

HTML Image

IMFROSTY

Whats Hot ?

This Domain Name is for Sale !! Please contact Admin : pandyanhardik@gmail.com, If you are interested to buy it..

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 ============


[hnpandya@localhost ~]$ python processA.py
Reverse of string from process B :

[hnpandya@localhost ~]$ 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 - 2017
*The Content Is Copyrighted To & May Not Be Copied / Republished.

Biểu mẫu liên hệ

Name

Email *

Message *

Powered by Blogger.