[Python-Dev] PATCH/RFC for AF_NETLINK support

Jp Calderone exarkun at divmod.com
Tue Jan 11 15:14:13 CET 2005


On Tue, 11 Jan 2005 08:54:42 +0100, "\"Martin v. Löwis\"" <martin at v.loewis.de> wrote:
>Philippe Biondi wrote:
> > I've done a small patch to use linux AF_NETLINK sockets (see below).
> > Please comment!
> 
> I have a high-level comment - python-dev is normally the wrong place
> for patches; please submit them to sf.net/projects/python instead.
> 
> Apart from that, the patch looks fine.
> 
> > Is there a reason for recvmsg() and sendmsg() not to be implemented
> > yet in socketmodule ?
> 
> I'm not sure what you mean by "implemented": these functions are
> implemented by the operating system, not in the socketmodule.
> 
> If you ask "why are they not exposed to Python yet?": There has been no
> need to do so, so far. What do I get with recvmsg that I cannot get with
> recv/recvfrom just as well?

  Everything that recvmsg() does.  recv() and recvfrom() give you 
"regular" bytes - data sent to the socket using send() or sendto().  
recvmsg() gives you messages - data sent to the socket using sendmsg().  
There is no way to receive messages by using recv() or recvfrom() (and 
no way to send them using send() or sendto()).

  Inversely, I believe send() and recv() can be implemented in terms of
sendmsg() and recvmsg().  Perhaps we should get rid of socket.send() and
socket.recv()? <wink>

  Other things that sendmsg() and recvmsg() can do include passing file 
descriptors, receiving notice of OOB TCP data, peek at bytes from the 
kernel's buffer without actually reading them, and implement 
scatter/gather IO functions (although you'd probably just want to wrap 
and use writev() and readv() instead).

  Jp


More information about the Python-Dev mailing list