[Qgis-developer] Socket server freezes on Python plugin
victorzinho at gmail.com
Tue Jun 19 03:50:00 PDT 2012
I tried Bernhard's solution and it worked like charm. After digging a
little more into PyQt I found this thread  with some answers. Seems like
QtNetworking deals with all this networking and threading issues
internally, so my problem is solved that way.
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.
Thanks for the help,
2012/6/19 G. Allegri <giohappy at gmail.com>
> The plugin server unfreezes even if you simply move the mouse over QGis
>> (wihtout doing any action on it).
> This happens only if you move the mouse over the Canvas, while the server
> remains freezed while moving on other areas (TOC, toolbar, etc.)
>> It must be investigated...
>> 2012/6/19 Víctor González <victorzinho at gmail.com>
>>> 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.
>>> 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
>>> I have looked into the PyQgis cookbook  and the contributed plugins
>>>  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.
>>> Thanks in advance,
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer