Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing QtHostinfo.lookupHost in PySide
    text
    copied!<p>I am working on a project where I want to confirm the existence of a host on a local network. In the QtNetwork package in Qt, the <code>QHostInfo::lookupHost</code> method is a convenient way of searching for a host without needing to implement any kind of pinging or being dependent on a ping system call. Its asynchronous call makes it convenient to create a dialog waiting for the call to return with a slot in either the dialog or the main program to handle the return.</p> <h3>From Qt's Documentation for QHostInfo:</h3> <blockquote> <p>To look up a host's IP addresses asynchronously, call lookupHost(), which takes the host name or IP address, a receiver object, and a slot signature as arguments and returns an ID. You can abort the lookup by calling abortHostLookup() with the lookup ID...</p> <p>The slot is invoked when the results are ready. The results are stored in a QHostInfo object. Call addresses() to get the list of IP addresses for the host, and hostName() to get the host name that was looked up.</p> </blockquote> <p><br>The documentation from PySide for <a href="http://www.pyside.org/docs/pyside/PySide/QtNetwork/QHostInfo.html" rel="nofollow"><code>QHostInfo</code></a> details usage of <code>lookupHost</code> but I think it might be automatically generated from the Qt documentation as by default, the method <code>lookupHost</code> is declared as a private method in the <a href="http://qt.gitorious.org/pyside/pyside-archive/blobs/master/PySide/QtNetwork/typesystem_network.xml" rel="nofollow">typesystem definition for QtNetwork</a>.</p> <p>Is there a particular reason that this method is declared private in the PySide implementation? Does it have to do with the asynchronous nature of the call and Python's GIL? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload