This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
2018-12-07 20:35:34 +00:00
|
|
|
import socket
|
2018-12-07 20:44:31 +00:00
|
|
|
|
2018-12-07 20:35:34 +00:00
|
|
|
import ujson
|
2018-12-07 20:44:31 +00:00
|
|
|
from ipc_unix.utils import read_payload
|
2018-12-07 20:35:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
def send_to(socket_path, data):
|
|
|
|
with socket.socket(socket.AF_UNIX, type=socket.SOCK_STREAM) as sock:
|
|
|
|
sock.connect(socket_path)
|
|
|
|
sock.sendall(ujson.dumps(data).encode() + b"\n")
|
|
|
|
return read_payload(sock)
|