diff --git a/sandbox/mmap_client.py b/sandbox/mmap_client.py new file mode 100755 index 000000000..1948b2571 --- /dev/null +++ b/sandbox/mmap_client.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python2.4 + +import mmap, os, time +mx = mmap.mmap(os.open('xxx',os.O_RDWR), 1) +last = None +while True: + mx.resize(mx.size()) + data = mx[:] + if data != last: + print data + last = data + time.sleep(1) \ No newline at end of file diff --git a/sandbox/mmap_server.py b/sandbox/mmap_server.py new file mode 100755 index 000000000..490dc61cc --- /dev/null +++ b/sandbox/mmap_server.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python2.4 + +fileob = open('xxx','w') +while True: + data = raw_input('Enter some text:') + fileob.seek(0) + fileob.write(data) + fileob.truncate() + fileob.flush() \ No newline at end of file