Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

socket.fromfd() with auto-detection of family and type

Project Description

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 History

This version
History Node

0.2.0

History Node

0.1.0

History Node

0.1.dev1

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
socketfromfd-0.2.0-py2.py3-none-any.whl
(4.2 kB) Copy SHA256 Hash SHA256
2.7 Wheel Jan 21, 2017
socketfromfd-0.2.0.tar.gz
(15.4 kB) Copy SHA256 Hash SHA256
Source Jan 21, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting