Created
September 16, 2012 10:54
-
-
Save quiver/3731968 to your computer and use it in GitHub Desktop.
Python port of half duplex FIFO program : http://developers.sun.com/solaris/articles/named_pipes.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python port of half duplex FIFO program : http://developers.sun.com/solaris/articles/named_pipes.html | |
import sys | |
import config | |
def main(): | |
if len(sys.argv) < 2: | |
print 'Usage : %s <string to be sent to the server>' % sys.argv[0] | |
sys.exit(0) | |
wr = open(config.HALF_DUPLEX, 'wb') | |
# write to the pipe | |
wr.write(sys.argv[1]) | |
wr.close() | |
if __name__ == '__main__': | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python port of half duplex FIFO program : http://developers.sun.com/solaris/articles/named_pipes.html | |
HALF_DUPLEX = "/tmp/halfduplex" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python port of half duplex FIFO program : http://developers.sun.com/solaris/articles/named_pipes.html | |
import os | |
import config | |
def main(): | |
os.mkfifo(config.HALF_DUPLEX, 0666) | |
# read from the pipe | |
rd = open(config.HALF_DUPLEX, 'rb') | |
buf = rd.read() | |
rd.close() | |
print 'Half Duplex Server:Rread From the pipe:%s' % buf | |
buf = buf.upper() | |
print 'Half Duplex Server:Converted String:%s' % buf | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment