[Twisted-Python] raw socket IWriteDescriptor

David Stainton dstainton415 at gmail.com
Tue Oct 1 02:05:47 MDT 2013


I just now realized that my fileno() method was incorrect.
It now returns the descriptor instead of the python socket:
return self.socket.fileno()

I add the socket to the reactor in the constructor like this:
reactor.addWriter(self)
BTW is that OK? Or is it better to add it to the reactor outside of the
constructor?


On Tue, Oct 1, 2013 at 12:54 AM, Phil Mayers <p.mayers at imperial.ac.uk>wrote:

> On 10/01/2013 08:30 AM, David Stainton wrote:
>
>>
>> Hi,
>>
>> I'm trying to implement an IWriteDescriptor using raw sockets.
>> So far this is what I wrote... but it doesn't work:
>> https://github.com/david415/**hushTCP/blob/master/hush_**writer.py<https://github.com/david415/hushTCP/blob/master/hush_writer.py>
>>
>> Am I doing something obviously wrong here?
>>
>
> 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.
>
> 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!)
>
>
> ______________________________**_________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.**com <Twisted-Python at twistedmatrix.com>
> http://twistedmatrix.com/cgi-**bin/mailman/listinfo/twisted-**python<http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20131001/e9db6ed4/attachment-0002.html>


More information about the Twisted-Python mailing list