Example unixsocket_client.pyΒΆ

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from __future__ import print_function
import socket

s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect("./unixsocket_server.py.sock")
s.send('GET / HTTP/1.0\r\n\r\n')
data = s.recv(1024)
print('received %s bytes' % len(data))
print(data)
s.close()

Current source

Next page: Example unixsocket_server.py