Hi folks!

I'm trying to pass some file descriptors over a UNIX domain socket.
But either I'm doing something wrong, or there is a bug in Python.
Here's my code:


=== testclient start ===
#!/usr/bin/env python3

from socket import socket, AF_UNIX, SOCK_STREAM, send_fds
import sys

path = '/tmp/test'

s = socket(AF_UNIX, SOCK_STREAM)
s.connect(path)
send_fds(s, [bytes()], [
    sys.stdin.fileno(),
    sys.stdout.fileno(),
    sys.stderr.fileno()
], 3, None)
=== testclient end ===


=== testserver start ===
#!/usr/bin/env python3

from socket import socket, AF_UNIX, SOCK_STREAM, recv_fds
from os.path import exists
from os import remove

path = '/tmp/test'

s = socket(AF_UNIX, SOCK_STREAM)
if exists(path):
    remove(path)
s.bind(path)
s.listen(-1)
c,_ = s.accept()
fds = recv_fds(c, 1024, 3)
print(fds)
=== testserver end ===


What's the issue?

Best wishes,
Fabiano

--
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to