Hi,<div><br></div><div>Good to know that =) I'll keep working on my plugin with PyQt. Thanks again for all the help!</div><div><br></div><div>Víctor.<br><br><div class="gmail_quote">2012/6/19 G. Allegri <span dir="ltr"><<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>No problems with your basic example with pure python threading. The problem is the interaction with the Qt event loop. That's why PyQt threading is there ;)</p>


<p>giovanni</p>
<p>Inviato da dispositivo mobile<br>
Il giorno 19/giu/2012 12.50, "Víctor González" <<a href="mailto:victorzinho@gmail.com" target="_blank">victorzinho@gmail.com</a>> ha scritto:</p><div><div class="h5"><br>
><br>
> Hi again, <br>
><br>
> I tried Bernhard's solution and it worked like charm. After digging a little more into PyQt I found this thread [1] with some answers. Seems like QtNetworking deals with all this networking and threading issues internally, so my problem is solved that way. <br>



><br>
> Regarding Giovanni's comments, I confirm that behavior but I'm not familiar with multithreading and networking in Python, so I cannot imagine what could be the difference between using QtNetworking vs. threading/socket and if that is the expected behavior or not.<br>



><br>
> Thanks for the help,<br>
> Víctor.<br>
><br>
> [1] <a href="http://python.6.n6.nabble.com/Threads-with-PyQt-Qt-s-or-Python-s-td1919800.html#a1919801" target="_blank">http://python.6.n6.nabble.com/Threads-with-PyQt-Qt-s-or-Python-s-td1919800.html#a1919801</a><br>


><br>
> 2012/6/19 G. Allegri <<a href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>><br>
><br>
>>> The plugin server unfreezes even if you simply move the mouse over QGis (wihtout doing any action on it).<br>
>><br>
>><br>
>> This happens only if you move the mouse over the Canvas, while the server remains freezed while moving on other areas (TOC, toolbar, etc.)<br>
>>  <br>
>>><br>
>>> It must be investigated...<br>
>>><br>
>>> giovanni<br>
>>><br>
>>> 2012/6/19 Víctor González <<a href="mailto:victorzinho@gmail.com" target="_blank">victorzinho@gmail.com</a>><br>
>>>><br>
>>>> Hi,<br>
>>>><br>
>>>> I'm trying to create a plugin that opens a socket server in a separate thread and handles requests. I create the server using SocketServer.TCPServer and threading.Thread in the initGui method and the plugin starts correctly, but if I try to get a response from a client, the server freezes and does not respond.<br>



>>>><br>
>>>> The strange thing is that I have added a toolbar button that opens and closes a file and, if I click that button, the server unfreezes and I get the response as expected. However, if I create the socket server with the same exact code as an standalone program, it works as expected without freezing.<br>



>>>><br>
>>>> I have looked into the PyQgis cookbook [1] and the contributed plugins [2] searching for an example or solution but I couldn't find anything. Does anyone know what may be wrong? Any hint will be greatly appreciated. I attach the Qgis plugin as well as the standalone server and client.<br>



>>>><br>
>>>> Thanks in advance, <br>
>>>> Víctor.<br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Qgis-developer mailing list<br>
>>>> <a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
>>>> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
>>>><br>
>>><br>
>><br>
><br>
</div></div><p></p>
</blockquote></div><br></div>