hoe to build a patched socketmodule.c

jacopo mondi mondi at cs.unibo.it
Fri Jul 10 11:16:14 EDT 2009


Roger Binns wrote:
> jacopo mondi wrote:
>> Hi all, I need to patch socketmodule.c (the _socket module) in order to
>> add support to an experimental socket family.
> 
> You may find it considerably easier to use ctypes since that will avoid
> the need for any patching.  You'll also be able to control how read and
> write are done (eg read vs recvfrom vs recvmsg vs readv).  You can use
> os.fdopen to convert your raw file descriptor into a Python file object
> if appropriate.
> 
> If you do use ctypes then you'll only need to distribute pure Python
> source code.
> 
> Roger

Wait a minute, am I confused or ctypes seems to be unusless for my needs?
Ctypes wraps a system shared object (as libc is) and gives you the
possibility to access its functions. What have I to wrap? the
fuctionalities I need to use are those exposed by the kernel via
sys/socket.h haeder (socket, bind, connect etc.).
Maybe I could wrapp _socket.so (I think it's possible) but seems to be
unuseless because I need to modify, for example, the parameters that
_socket.so passes to the socket() function in order to create a socket
owned by the new socket family I'm actualy experimenting.
Hope it's clear what I'm trying to explain...

Thanks anyway, but ctypes doen't seem to fit my needs..

cheers
	jacopo



More information about the Python-list mailing list