mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Add simple Unix socket example by Piet van Oostrum.
This commit is contained in:
parent
5b8b8cd6c0
commit
dd918a990a
3 changed files with 27 additions and 1 deletions
10
Demo/sockets/unixclient.py
Normal file
10
Demo/sockets/unixclient.py
Normal file
|
@ -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`
|
Loading…
Add table
Add a link
Reference in a new issue