Folks,
Attached is a patch which adds SOCK_SEQPACKET to the PF_UNIX protocol
family. It doesn't seem to break SOCK_STREAM or SOCK_DGRAM for PF_UNIX
and adds the desired functionality. I could find alot of questions
about "is this supported" but only one response stating as of yet it is
not.
SOCK_DGRAM doesn't work on connected sockets. Using SOCK_STREAM for
connection oriented sockets requires the application to frame if
variable length messages are desired.
This patch provides the best of both of those protocols by following the
SOCK_SEQPACKET semantics of allowing datagrams over connected PF_UNIX
sockets.
SOCK_SEQPACKET provides several advantages over SOCK_STREAM or
SOCK_DGRAM:
1. only one system call (vs two for SOCK_STREAM) is required for
variable length messages, no framing is required
2. the end of a large message can be discarded without processing if the
application is only interested in the beginning of the message.
3. connected fds can be used to uniquely identify a connection. (the
kernel is used to ensure application security).
Comments welcome, enjoy
-steve
linux-2.6.3-af_unix-sockseqpacket.patch
Description: Text document
|