summaryrefslogtreecommitdiffstats
path: root/Demo/sockets/unixclient.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-01-28 16:54:00 (GMT)
committerGuido van Rossum <guido@python.org>1998-01-28 16:54:00 (GMT)
commitdd918a990a274c808081d35beb1fd222385c86b3 (patch)
tree7297644eee4432f9d8477426256418e772406737 /Demo/sockets/unixclient.py
parent5b8b8cd6c08d8efb62d26ee6ec878a792a71d16f (diff)
downloadcpython-dd918a990a274c808081d35beb1fd222385c86b3.zip
cpython-dd918a990a274c808081d35beb1fd222385c86b3.tar.gz
cpython-dd918a990a274c808081d35beb1fd222385c86b3.tar.bz2
Add simple Unix socket example by Piet van Oostrum.
Diffstat (limited to 'Demo/sockets/unixclient.py')
-rw-r--r--Demo/sockets/unixclient.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Demo/sockets/unixclient.py b/Demo/sockets/unixclient.py
new file mode 100644
index 0000000..a0d80f6
--- /dev/null
+++ b/Demo/sockets/unixclient.py
@@ -0,0 +1,10 @@
+# Echo client demo using Unix sockets
+# Piet van Oostrum
+from socket import *
+FILE = 'blabla'
+s = socket(AF_UNIX, SOCK_STREAM)
+s.connect(FILE)
+s.send('Hello, world')
+data = s.recv(1024)
+s.close()
+print 'Received', `data`