<div dir="ltr"><div><br></div>I just now realized that my fileno() method was incorrect.<div>It now returns the descriptor instead of the python socket:</div><div>return self.socket.fileno()<br></div><div><br></div><div>I add the socket to the reactor in the constructor like this: reactor.addWriter(self)</div>
<div>BTW is that OK? Or is it better to add it to the reactor outside of the constructor?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 1, 2013 at 12:54 AM, Phil Mayers <span dir="ltr"><<a href="mailto:p.mayers@imperial.ac.uk" target="_blank">p.mayers@imperial.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 10/01/2013 08:30 AM, David Stainton wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Hi,<br>
<br>
I'm trying to implement an IWriteDescriptor using raw sockets.<br>
So far this is what I wrote... but it doesn't work:<br>
<a href="https://github.com/david415/hushTCP/blob/master/hush_writer.py" target="_blank">https://github.com/david415/<u></u>hushTCP/blob/master/hush_<u></u>writer.py</a><br>
<br>
Am I doing something obviously wrong here?<br>
</blockquote>
<br></div>
I don't see you trying to add the raw socket to the reactor anywhere; typically you'll want to do at least reactor.addWriter(hush), but for a proper implementation there's more - see the IReactorFDSet docs.<br>

<br>
You may want to look at the udp code in Twisted to see how this is done under the hood (although TBH it can be hard to follow!)<br>
<br>
<br>
______________________________<u></u>_________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.<u></u>com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-<u></u>bin/mailman/listinfo/twisted-<u></u>python</a><br>
</blockquote></div><br></div>