Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 840

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QLocalServer Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QLocalServer Class Reference<br /><sup><sup>[<a href="qtnetwork.html">QtNetwork</a> module]</sup></sup></h1><p>The QLocalServer class provides a local socket based server.
<a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlocalserver.html#QLocalServer">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qlocalserver.html#close">close</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qlocalserver.html#errorString">errorString</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qlocalserver.html#fullServerName">fullServerName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalserver.html#hasPendingConnections">hasPendingConnections</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlocalserver.html#incomingConnection">incomingConnection</a></b> (<i>self</i>, sip.voidptr&#160;<i>socketDescriptor</i>)</li><li><div class="fn" />bool <b><a href="qlocalserver.html#isListening">isListening</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalserver.html#listen">listen</a></b> (<i>self</i>, QString&#160;<i>name</i>)</li><li><div class="fn" />int <b><a href="qlocalserver.html#maxPendingConnections">maxPendingConnections</a></b> (<i>self</i>)</li><li><div class="fn" />QLocalSocket <b><a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractSocket.SocketError <b><a href="qlocalserver.html#serverError">serverError</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qlocalserver.html#serverName">serverName</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlocalserver.html#setMaxPendingConnections">setMaxPendingConnections</a></b> (<i>self</i>, int&#160;<i>numConnections</i>)</li><li><div class="fn" />(bool, bool&#160;<i>timedOut</i>) <b><a href="qlocalserver.html#waitForNewConnection">waitForNewConnection</a></b> (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;0)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />bool <b><a href="qlocalserver.html#removeServer">removeServer</a></b> (QString&#160;<i>name</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qlocalserver.html#newConnection">newConnection</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QLocalServer class provides a local socket based server.</p>
<p>This class makes it possible to accept incoming local socket
connections.</p>
<p>Call <a href="qlocalserver.html#listen">listen</a>() to have the
server start listening for incoming connections on a specified key.
The <a href="qlocalserver.html#newConnection">newConnection</a>()
signal is then emitted each time a client connects to the
server.</p>
<p>Call <a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a>()
to accept the pending connection as a connected <a href="qlocalsocket.html">QLocalSocket</a>. The function returns a
pointer to a <a href="qlocalsocket.html">QLocalSocket</a> that can
be used for communicating with the client.</p>
<p>If an error occurs, <a href="qlocalserver.html#serverError">serverError</a>() returns the type
of error, and <a href="qlocalserver.html#errorString">errorString</a>() can be called to
get a human readable description of what happened.</p>
<p>When listening for connections, the name which the server is
listening on is available through <a href="qlocalserver.html#serverName">serverName</a>().</p>
<p>Calling <a href="qlocalserver.html#close">close</a>() makes
QLocalServer stop listening for incoming connections.</p>
<p>Although QLocalServer is designed for use with an event loop,
it's possible to use it without one. In that case, you must use
<a href="qlocalserver.html#waitForNewConnection">waitForNewConnection</a>(),
which blocks until either a connection is available or a timeout
expires.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLocalServer" />QLocalServer.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Create a new local socket server with the given
<i>parent</i>.</p>
<p><b>See also</b> <a href="qlocalserver.html#listen">listen</a>().</p>


<h3 class="fn"><a name="close" />QLocalServer.close (<i>self</i>)</h3><p>Stop listening for incoming connections. Existing connections
are not effected, but any new connections will be refused.</p>
<p><b>See also</b> <a href="qlocalserver.html#isListening">isListening</a>() and <a href="qlocalserver.html#listen">listen</a>().</p>


<h3 class="fn"><a name="errorString" />QString QLocalServer.errorString (<i>self</i>)</h3><p>Returns the human-readable message appropriate to the current
error reported by <a href="qlocalserver.html#serverError">serverError</a>(). If no suitable
string is available, an empty string is returned.</p>
<p><b>See also</b> <a href="qlocalserver.html#serverError">serverError</a>().</p>


<h3 class="fn"><a name="fullServerName" />QString QLocalServer.fullServerName (<i>self</i>)</h3><p>Returns the full path that the server is listening on.</p>
<p>Note: This is platform specific</p>
<p><b>See also</b> <a href="qlocalserver.html#listen">listen</a>()
and <a href="qlocalserver.html#serverName">serverName</a>().</p>


<h3 class="fn"><a name="hasPendingConnections" />bool QLocalServer.hasPendingConnections (<i>self</i>)</h3><p>Returns true if the server has a pending connection; otherwise
returns false.</p>
<p><b>See also</b> <a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a>()
and <a href="qlocalserver.html#setMaxPendingConnections">setMaxPendingConnections</a>().</p>


<h3 class="fn"><a name="incomingConnection" />QLocalServer.incomingConnection (<i>self</i>, sip.voidptr&#160;<i>socketDescriptor</i>)</h3><p>This virtual function is called by <a href="qlocalserver.html">QLocalServer</a> when a new connection is
available. <i>socketDescriptor</i> is the native socket descriptor
for the accepted connection.</p>
<p>The base implementation creates a <a href="qlocalsocket.html">QLocalSocket</a>, sets the socket descriptor
and then stores the <a href="qlocalsocket.html">QLocalSocket</a> in
an internal list of pending connections. Finally <a href="qlocalserver.html#newConnection">newConnection</a>() is
emitted.</p>
<p>Reimplement this function to alter the server's behavior when a
connection is available.</p>
<p><b>See also</b> <a href="qlocalserver.html#newConnection">newConnection</a>(), <a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a>(),
and <a href="qlocalsocket.html#setSocketDescriptor">QLocalSocket.setSocketDescriptor</a>().</p>


<h3 class="fn"><a name="isListening" />bool QLocalServer.isListening (<i>self</i>)</h3><p>Returns true if the server is listening for incoming connections
otherwise false.</p>
<p><b>See also</b> <a href="qlocalserver.html#listen">listen</a>()
and <a href="qlocalserver.html#close">close</a>().</p>


<h3 class="fn"><a name="listen" />bool QLocalServer.listen (<i>self</i>, QString&#160;<i>name</i>)</h3><p>Tells the server to listen for incoming connections on
<i>name</i>. If the server is currently listening then it will
return false. Return true on success otherwise false.</p>
<p><i>name</i> can be a single name and <a href="qlocalserver.html">QLocalServer</a> will determine the correct
platform specific path. <a href="qlocalserver.html#serverName">serverName</a>() will return the
name that is passed into listen.</p>
<p>Usually you would just pass in a name like "foo", but on Unix
this could also be a path such as "/tmp/foo" and on Windows this
could be a pipe path such as "\\.\pipe\foo". For VxWorks following
path must be always use "/comp/socket/0xNumber", where "0xNumber"
is a string representation of a 16-bit number in hexadecimal
format. Example "/comp/socket/0x00AA".</p>
<p>Note: On Unix if the server crashes without closing listen will
fail with AddressInUseError. To create a new server the file should
be removed. On Windows two local servers can listen to the same
pipe at the same time, but any connections will go to one of the
server.</p>
<p><b>See also</b> <a href="qlocalserver.html#serverName">serverName</a>(), <a href="qlocalserver.html#isListening">isListening</a>(), and <a href="qlocalserver.html#close">close</a>().</p>


<h3 class="fn"><a name="maxPendingConnections" />int QLocalServer.maxPendingConnections (<i>self</i>)</h3><p>Returns the maximum number of pending accepted connections. The
default is 30.</p>
<p><b>See also</b> <a href="qlocalserver.html#setMaxPendingConnections">setMaxPendingConnections</a>()
and <a href="qlocalserver.html#hasPendingConnections">hasPendingConnections</a>().</p>


<h3 class="fn"><a name="nextPendingConnection" /><a href="qlocalsocket.html">QLocalSocket</a> QLocalServer.nextPendingConnection (<i>self</i>)</h3><p>Returns the next pending connection as a connected <a href="qlocalsocket.html">QLocalSocket</a> object.</p>
<p>The socket is created as a child of the server, which means that
it is automatically deleted when the <a href="qlocalserver.html">QLocalServer</a> object is destroyed. It is
still a good idea to delete the object explicitly when you are done
with it, to avoid wasting memory.</p>
<p>0 is returned if this function is called when there are no
pending connections.</p>
<p><b>See also</b> <a href="qlocalserver.html#hasPendingConnections">hasPendingConnections</a>(),
<a href="qlocalserver.html#newConnection">newConnection</a>(), and
<a href="qlocalserver.html#incomingConnection">incomingConnection</a>().</p>


<h3 class="fn"><a name="removeServer" />bool QLocalServer.removeServer (QString&#160;<i>name</i>)</h3><p>Removes any server instance that might cause a call to <a href="qlocalserver.html#listen">listen</a>() to fail and returns true if
successful; otherwise returns false. This function is meant to
recover from a crash, when the previous server instance has not
been cleaned up.</p>
<p>On Windows, this function does nothing; on Unix, it removes the
socket file given by <i>name</i>.</p>
<p><b>Warning:</b> Be careful to avoid removing sockets of running
instances.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="serverError" /><a href="qabstractsocket.html#SocketError-enum">QAbstractSocket.SocketError</a> QLocalServer.serverError (<i>self</i>)</h3><p>Returns the type of error that occurred last or NoError.</p>
<p><b>See also</b> <a href="qlocalserver.html#errorString">errorString</a>().</p>


<h3 class="fn"><a name="serverName" />QString QLocalServer.serverName (<i>self</i>)</h3><p>Returns the server name if the server is listening for
connections; otherwise returns QString()</p>
<p><b>See also</b> <a href="qlocalserver.html#listen">listen</a>()
and <a href="qlocalserver.html#fullServerName">fullServerName</a>().</p>


<h3 class="fn"><a name="setMaxPendingConnections" />QLocalServer.setMaxPendingConnections (<i>self</i>, int&#160;<i>numConnections</i>)</h3><p>Sets the maximum number of pending accepted connections to
<i>numConnections</i>. <a href="qlocalserver.html">QLocalServer</a>
will accept no more than <i>numConnections</i> incoming connections
before <a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a>()
is called.</p>
<p>Note: Even though <a href="qlocalserver.html">QLocalServer</a>
will stop accepting new connections after it has reached its
maximum number of pending connections, the operating system may
still keep them in queue which will result in clients signaling
that it is connected.</p>
<p><b>See also</b> <a href="qlocalserver.html#maxPendingConnections">maxPendingConnections</a>()
and <a href="qlocalserver.html#hasPendingConnections">hasPendingConnections</a>().</p>


<h3 class="fn"><a name="waitForNewConnection" />(bool, bool&#160;<i>timedOut</i>) QLocalServer.waitForNewConnection (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;0)</h3><p>Waits for at most <i>msec</i> milliseconds or until an incoming
connection is available. Returns true if a connection is available;
otherwise returns false. If the operation timed out and
<i>timedOut</i> is not 0, *timedOut will be set to true.</p>
<p>This is a blocking function call. Its use is ill-advised in a
single-threaded GUI application, since the whole application will
stop responding until the function returns. waitForNewConnection()
is mostly useful when there is no event loop available.</p>
<p>The non-blocking alternative is to connect to the <a href="qlocalserver.html#newConnection">newConnection</a>() signal.</p>
<p>If msec is -1, this function will not time out.</p>
<p><b>See also</b> <a href="qlocalserver.html#hasPendingConnections">hasPendingConnections</a>()
and <a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a>().</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="newConnection" />void newConnection ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted every time a new connection is
available.</p>
<p><b>See also</b> <a href="qlocalserver.html#hasPendingConnections">hasPendingConnections</a>()
and <a href="qlocalserver.html#nextPendingConnection">nextPendingConnection</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>