<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-15"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Drew Smathers wrote:<!----><br>
<blockquote
 cite="mid:368574aa0802221335p7bebc061x9547f968b1d44a02@mail.gmail.com"
 type="cite">
  <pre wrap="">You should not make assumptions about the transport layer in your
protocol implementation - be it Unix domain sockets, TCP, etc.
  </pre>
</blockquote>
In my case, it is not only an assumption: the applications I want to
interact with do use unix sockets and file descriptor passing.<br>
Maybe my assumption that I need to use a Protocol is wrong, if I need a
specific transport.<br>
<br>
<blockquote
 cite="mid:368574aa0802221335p7bebc061x9547f968b1d44a02@mail.gmail.com"
 type="cite">
  <pre wrap="">If you don't see an attribute documented in the interface for
something (ITransport here for example), and you're referencing it on
the implementation, then you're most definitely doing something bad.
The attribute I'm talking about here is "socket."
  </pre>
</blockquote>
OK. So what attribute(s) do I have to replace/override to plug my
low-level read/write routines in a protocol ?<br>
<br>
<blockquote
 cite="mid:368574aa0802221335p7bebc061x9547f968b1d44a02@mail.gmail.com"
 type="cite">
  <pre wrap="">It sounds like you're trying to do something relatively low-level
(interfacing with eunuchs directly) at a high-level using Protocols.
  </pre>
</blockquote>
Maybe I don't need to use a Protocol at all. But what else ?<br>
<blockquote
 cite="mid:368574aa0802221335p7bebc061x9547f968b1d44a02@mail.gmail.com"
 type="cite">
  <pre wrap="">So to do something that isn't just a hack, you'll need to do a lot
more work - and it might not be worth the effort.  Can you describe
first why you need to use sendmsg/recvmsg in your application?
  </pre>
</blockquote>
<br>
As I said above, I would like to interact with a set of (existing)
applications that use unix sockets and TLV-based messages for
interprocess communication.<br>
They also use file descriptor passing with sendmsg/recvmsg. <br>
In fact, this is the way they find each other: services announce
themselves to a central broker, and clients ask for services to this
broker. The broker then creates a socketpair and passes the file
descriptor of both ends to each party.<br>
They also make use of this file descriptor passing mechanism to use
specific devices from different processes while keeping their state and
"ownership": once one process has made some initialization on a device,
it can pass the descriptor to another process that can use it further.<br>
<br>
The C framework on which these applications are written is completely
asynchronous and the model seems fine.<br>
I was able to use asyncore with eunuchs to do this low-level stuff as
prototype, but I really would like to use Twisted instead.<br>
<br>
As far as I can see, the low-level doRead and doWrite implementations
are about the only thing I have to plug in the system to have it
working.<br>
In fact my sample code is mostly working, I just want to be sure I do
it The Right Way, if at all possible.<br>
<br>
Please, don't tell me Twisted is not made for something other than byte
stream based comms... :-)<br>
<br>
Thank you for your help.<br>
</body>
</html>