<br><br><div class="gmail_quote">2008/5/7  &lt;<a href="mailto:glyph@divmod.com">glyph@divmod.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
On 09:38 pm, <a href="mailto:matthieu.brucher@gmail.com" target="_blank">matthieu.brucher@gmail.com</a> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I&#39;m currently trying to implement the JXTA standard (<a href="http://www.jxta.org" target="_blank">http://www.jxta.org</a>) in<br>
Python using twisted (because it seems to be the right choice). I&#39;ve<br>
implemented the basic parts that are not network related, that is, not much<br>
;)<br>
</blockquote>
<br></div>
Of course it&#39;s the right choice. &nbsp;Twisted is *awesome* ;-).<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
network -&gt; TCP transport layer service -&gt; endpoint service -&gt; some other<br>
high level services -&gt; endpoint service -&gt; TCP transport layer<br>
</blockquote>
<br></div>
You use the word &quot;service&quot; a lot here and I&#39;m not sure I understand it. There are, unfortunately, a dozen or so things you could mean by it.</blockquote><div><br>Yes, I know, it is not perfectly clear in my head as well, I have to play with twisted and JXTA a little more to have a clear picture.<br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is there a sample somewhere that does something like this ? Each time an<br>
event is sent to a listener (the TCP transport layer, the endpoint, ...)<br>
that acts upon it. I&#39;ve tried to find some samples over the Internet, but<br>
perhaps someone has a pointer to help me ?<br>
</blockquote>
<br></div>
Assuming I do understand what all those &quot;service&quot; and &quot;-&gt;&quot;s mean in the above text, all you need to do is to<br>
<br>
&nbsp;1) have some objects<br>
&nbsp;2) keep references between them to other objects<br>
&nbsp;3) call methods on the relevant objects when the relevant things happen<br>
<br>
Quite often, people somehow arrive at the incorrect conclusion that because twisted is event-driven, it has some magic &quot;event&quot; mechanism you have to use to get different pieces of code to talk to each other. Quite the opposite; the whole point of Twisted is to reduce event-driven programming to just regular Python method calls.</blockquote>
<div><br>That&#39;s what I thought reading the tutorial.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">It may help, if you need to relay messages from one connected Protocol object to another, that Protocol objects have a reference to their factory, and you can easily keep a list of &quot;all connections&quot; on that factory. &nbsp;This is actually two of our FAQs - have a look at this one and the next one:<br>

<br>
 &nbsp; <a href="http://tinyurl.com/6hpfa7" target="_blank">http://tinyurl.com/6hpfa7</a><br>
</blockquote></div><br>Excallent ! Thanks a lot for this, it will help me a lot !<br clear="all"><br>Matthieu<br>-- <br>French PhD student<br>Website : <a href="http://matthieu-brucher.developpez.com/">http://matthieu-brucher.developpez.com/</a><br>
Blogs : <a href="http://matt.eifelle.com">http://matt.eifelle.com</a> and <a href="http://blog.developpez.com/?blog=92">http://blog.developpez.com/?blog=92</a><br>LinkedIn : <a href="http://www.linkedin.com/in/matthieubrucher">http://www.linkedin.com/in/matthieubrucher</a>