socketfromfd is an enhanced version of socket.fromfd() from Python’s standard library. It uses ctypes and libc’s getsockopt() function to auto-detect the file descriptor’s socket family, type and protocol.
>>> import socket
>>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sock
<socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 0)>
>>> from socketfromfd import fromfd
>>> newsock = fromfd(sock.fileno())
>>> newsock
<socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 0)>
Release files for socketfromfd 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| socketfromfd-0.2.0.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| socketfromfd-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / socketfromfd-0.2.0.tar.gz
| Download URL | socketfromfd-0.2.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0a4a1289c7831bd1c80677cee5968146cab79ca310c8a2d10153fe6e9057d53
|
|
BLAKE2b-256 checksum How to use checksums |
31f31098adca75306ae35bd5a4b5881570517c87da124803a363c7780f635dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / socketfromfd-0.2.0-py2.py3-none-any.whl
| Download URL | socketfromfd-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9c2737ad21168f0e9bc92ac0094aaffef8bbf04aae709d0fbcf1dabf9f020f72
|
|
BLAKE2b-256 checksum How to use checksums |
f20a5aad7c524ec46348587ecd919247a011b60ebdb8f0fd89c45778d8b642b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |