<?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>QLocalSocket 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">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QLocalSocket Class Reference<br /><sup><sup>[<a href="qtnetwork.html">QtNetwork</a> module]</sup></sup></h1><p>The QLocalSocket class provides a local socket. <a href="#details">More...</a></p> <p>Inherits <a href="qiodevice.html">QIODevice</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qlocalsocket.html#LocalSocketError-enum">LocalSocketError</a></b> { ConnectionRefusedError, PeerClosedError, ServerNotFoundError, SocketAccessError, ..., UnknownSocketError }</li><li><div class="fn" />enum <b><a href="qlocalsocket.html#LocalSocketState-enum">LocalSocketState</a></b> { UnconnectedState, ConnectingState, ConnectedState, ClosingState }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlocalsocket.html#QLocalSocket">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qlocalsocket.html#abort">abort</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlocalsocket.html#bytesAvailable">bytesAvailable</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlocalsocket.html#bytesToWrite">bytesToWrite</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#canReadLine">canReadLine</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlocalsocket.html#close">close</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlocalsocket.html#connectToServer">connectToServer</a></b> (<i>self</i>, QString <i>name</i>, QIODevice.OpenMode <i>mode</i> = QIODevice.ReadWrite)</li><li><div class="fn" /><b><a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a></b> (<i>self</i>)</li><li><div class="fn" />LocalSocketError <b><a href="qlocalsocket.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#flush">flush</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qlocalsocket.html#fullServerName">fullServerName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#isSequential">isSequential</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlocalsocket.html#readBufferSize">readBufferSize</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qlocalsocket.html#readData">readData</a></b> (<i>self</i>, int <i>maxlen</i>)</li><li><div class="fn" />QString <b><a href="qlocalsocket.html#serverName">serverName</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlocalsocket.html#setReadBufferSize">setReadBufferSize</a></b> (<i>self</i>, int <i>size</i>)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#setSocketDescriptor">setSocketDescriptor</a></b> (<i>self</i>, sip.voidptr <i>socketDescriptor</i>, LocalSocketState <i>state</i> = QLocalSocket.ConnectedState, QIODevice.OpenMode <i>mode</i> = QIODevice.ReadWrite)</li><li><div class="fn" />sip.voidptr <b><a href="qlocalsocket.html#socketDescriptor">socketDescriptor</a></b> (<i>self</i>)</li><li><div class="fn" />LocalSocketState <b><a href="qlocalsocket.html#state">state</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a></b> (<i>self</i>, int <i>msecs</i> = 30000)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForConnected">waitForConnected</a></b> (<i>self</i>, int <i>msecs</i> = 30000)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForDisconnected">waitForDisconnected</a></b> (<i>self</i>, int <i>msecs</i> = 30000)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForReadyRead">waitForReadyRead</a></b> (<i>self</i>, int <i>msecs</i> = 30000)</li><li><div class="fn" />int <b><a href="qlocalsocket.html#writeData">writeData</a></b> (<i>self</i>, str)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qlocalsocket.html#connected">connected</a></b> ()</li><li><div class="fn" />void <b><a href="qlocalsocket.html#disconnected">disconnected</a></b> ()</li><li><div class="fn" />void <b><a href="qlocalsocket.html#error-2">error</a></b> (QLocalSocket::LocalSocketError)</li><li><div class="fn" />void <b><a href="qlocalsocket.html#stateChanged">stateChanged</a></b> (QLocalSocket::LocalSocketState)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QLocalSocket class provides a local socket.</p> <p>On Windows this is a named pipe and on Unix this is a local domain socket.</p> <p>If an error occurs, socketError() returns the type of error, and <a href="qiodevice.html#errorString">errorString</a>() can be called to get a human readable description of what happened.</p> <p>Although QLocalSocket is designed for use with an event loop, it's possible to use it without one. In that case, you must use <a href="qlocalsocket.html#waitForConnected">waitForConnected</a>(), <a href="qlocalsocket.html#waitForReadyRead">waitForReadyRead</a>(), <a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a>(), and <a href="qlocalsocket.html#waitForDisconnected">waitForDisconnected</a>() which blocks until the operation is complete or the timeout expires.</p> <p>Note that this feature is not supported on versions of Windows earlier than Windows XP.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="LocalSocketError-enum" />QLocalSocket.LocalSocketError</h3><p>The LocalServerError enumeration represents the errors that can occur. The most recent error can be retrieved through a call to <a href="qlocalsocket.html#error">QLocalSocket.error</a>().</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"> <tt>QLocalSocket.ConnectionRefusedError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.ConnectionRefusedError</tt></td> <td class="topAlign">The connection was refused by the peer (or timed out).</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.PeerClosedError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.RemoteHostClosedError</tt></td> <td class="topAlign">The remote socket closed the connection. Note that the client socket (i.e., this socket) will be closed after the remote close notification has been sent.</td> </tr> <tr> <td class="topAlign"> <tt>QLocalSocket.ServerNotFoundError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.HostNotFoundError</tt></td> <td class="topAlign">The local socket name was not found.</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.SocketAccessError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.SocketAccessError</tt></td> <td class="topAlign">The socket operation failed because the application lacked the required privileges.</td> </tr> <tr> <td class="topAlign"> <tt>QLocalSocket.SocketResourceError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.SocketResourceError</tt></td> <td class="topAlign">The local system ran out of resources (e.g., too many sockets).</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.SocketTimeoutError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.SocketTimeoutError</tt></td> <td class="topAlign">The socket operation timed out.</td> </tr> <tr> <td class="topAlign"> <tt>QLocalSocket.DatagramTooLargeError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.DatagramTooLargeError</tt></td> <td class="topAlign">The datagram was larger than the operating system's limit (which can be as low as 8192 bytes).</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.ConnectionError</tt></td> <td class="topAlign"><tt>QAbstractSocket.NetworkError</tt></td> <td class="topAlign">An error occurred with the connection.</td> </tr> <tr> <td class="topAlign"> <tt>QLocalSocket.UnsupportedSocketOperationError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.UnsupportedSocketOperationError</tt></td> <td class="topAlign">The requested socket operation is not supported by the local operating system.</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.UnknownSocketError</tt></td> <td class="topAlign"> <tt>QAbstractSocket.UnknownSocketError</tt></td> <td class="topAlign">An unidentified error occurred.</td> </tr> </table> <h3 class="fn"><a name="LocalSocketState-enum" />QLocalSocket.LocalSocketState</h3><p>This enum describes the different states in which a socket can be.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.UnconnectedState</tt></td> <td class="topAlign"> <tt>QAbstractSocket.UnconnectedState</tt></td> <td class="topAlign">The socket is not connected.</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.ConnectingState</tt></td> <td class="topAlign"><tt>QAbstractSocket.ConnectingState</tt></td> <td class="topAlign">The socket has started establishing a connection.</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.ConnectedState</tt></td> <td class="topAlign"><tt>QAbstractSocket.ConnectedState</tt></td> <td class="topAlign">A connection is established.</td> </tr> <tr> <td class="topAlign"><tt>QLocalSocket.ClosingState</tt></td> <td class="topAlign"><tt>QAbstractSocket.ClosingState</tt></td> <td class="topAlign">The socket is about to close (data may still be waiting to be written).</td> </tr> </table> <p><b>See also</b> <a href="qlocalsocket.html#state">QLocalSocket.state</a>().</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLocalSocket" />QLocalSocket.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = 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>Creates a new local socket. The <i>parent</i> argument is passed to <a href="qobject.html">QObject</a>'s constructor.</p> <h3 class="fn"><a name="abort" />QLocalSocket.abort (<i>self</i>)</h3><p>Aborts the current connection and resets the socket. Unlike <a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>(), this function immediately closes the socket, clearing any pending data in the write buffer.</p> <p><b>See also</b> <a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>() and <a href="qlocalsocket.html#close">close</a>().</p> <h3 class="fn"><a name="bytesAvailable" />int QLocalSocket.bytesAvailable (<i>self</i>)</h3><p>Reimplemented from <a href="qiodevice.html#bytesAvailable">QIODevice.bytesAvailable</a>().</p> <h3 class="fn"><a name="bytesToWrite" />int QLocalSocket.bytesToWrite (<i>self</i>)</h3><p>Reimplemented from <a href="qiodevice.html#bytesToWrite">QIODevice.bytesToWrite</a>().</p> <h3 class="fn"><a name="canReadLine" />bool QLocalSocket.canReadLine (<i>self</i>)</h3><p>Reimplemented from <a href="qiodevice.html#canReadLine">QIODevice.canReadLine</a>().</p> <h3 class="fn"><a name="close" />QLocalSocket.close (<i>self</i>)</h3><p>Reimplemented from <a href="qiodevice.html#close">QIODevice.close</a>().</p> <h3 class="fn"><a name="connectToServer" />QLocalSocket.connectToServer (<i>self</i>, QString <i>name</i>, <a href="qiodevice-openmode.html">QIODevice.OpenMode</a> <i>mode</i> = QIODevice.ReadWrite)</h3><p>Attempts to make a connection to <i>name</i>.</p> <p>The socket is opened in the given <i>openMode</i> and first enters <a href="qlocalsocket.html#LocalSocketState-enum">ConnectingState</a>. It then attempts to connect to the address or addresses returned by the lookup. Finally, if a connection is established, <a href="qlocalsocket.html">QLocalSocket</a> enters <a href="qlocalsocket.html#LocalSocketState-enum">ConnectedState</a> and emits <a href="qlocalsocket.html#connected">connected</a>().</p> <p>At any point, the socket can emit <a href="qlocalsocket.html#error">error</a>() to signal that an error occurred.</p> <p>See also <a href="qlocalsocket.html#state">state</a>(), <a href="qlocalsocket.html#serverName">serverName</a>(), and <a href="qlocalsocket.html#waitForConnected">waitForConnected</a>().</p> <h3 class="fn"><a name="disconnectFromServer" />QLocalSocket.disconnectFromServer (<i>self</i>)</h3><p>Attempts to close the socket. If there is pending data waiting to be written, <a href="qlocalsocket.html">QLocalSocket</a> will enter <a href="qlocalsocket.html#LocalSocketState-enum">ClosingState</a> and wait until all data has been written. Eventually, it will enter <a href="qlocalsocket.html#LocalSocketState-enum">UnconnectedState</a> and emit the disconnectedFromServer() signal.</p> <p><b>See also</b> <a href="qlocalsocket.html#connectToServer">connectToServer</a>().</p> <h3 class="fn"><a name="error" /><a href="qlocalsocket.html#LocalSocketError-enum">LocalSocketError</a> QLocalSocket.error (<i>self</i>)</h3><p>Returns the type of error that last occurred.</p> <p><b>See also</b> <a href="qlocalsocket.html#state">state</a>() and <a href="qiodevice.html#errorString">errorString</a>().</p> <h3 class="fn"><a name="flush" />bool QLocalSocket.flush (<i>self</i>)</h3><p>This function writes as much as possible from the internal write buffer to the socket, without blocking. If any data was written, this function returns true; otherwise false is returned.</p> <p>Call this function if you need <a href="qlocalsocket.html">QLocalSocket</a> to start sending buffered data immediately. The number of bytes successfully written depends on the operating system. In most cases, you do not need to call this function, because <a href="qlocalsocket.html">QLocalSocket</a> will start sending data automatically once control goes back to the event loop. In the absence of an event loop, call <a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a>() instead.</p> <p><b>See also</b> <a href="qiodevice.html#write">write</a>() and <a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a>().</p> <h3 class="fn"><a name="fullServerName" />QString QLocalSocket.fullServerName (<i>self</i>)</h3><p>Returns the server path that the socket is connected to.</p> <p><b>Note:</b> The return value of this function is platform specific.</p> <p><b>See also</b> <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#serverName">serverName</a>().</p> <h3 class="fn"><a name="isSequential" />bool QLocalSocket.isSequential (<i>self</i>)</h3><p>Reimplemented from <a href="qiodevice.html#isSequential">QIODevice.isSequential</a>().</p> <h3 class="fn"><a name="isValid" />bool QLocalSocket.isValid (<i>self</i>)</h3><p>Returns true if the socket is valid and ready for use; otherwise returns false.</p> <p><b>Note:</b> The socket's state must be <a href="qlocalsocket.html#LocalSocketState-enum">ConnectedState</a> before reading and writing can occur.</p> <p><b>See also</b> <a href="qlocalsocket.html#state">state</a>() and <a href="qlocalsocket.html#connectToServer">connectToServer</a>().</p> <h3 class="fn"><a name="readBufferSize" />int QLocalSocket.readBufferSize (<i>self</i>)</h3><p>Returns the size of the internal read buffer. This limits the amount of data that the client can receive before you call <a href="qiodevice.html#read">read</a>() or <a href="qiodevice.html#readAll">readAll</a>(). A read buffer size of 0 (the default) means that the buffer has no size limit, ensuring that no data is lost.</p> <p><b>See also</b> <a href="qlocalsocket.html#setReadBufferSize">setReadBufferSize</a>() and <a href="qiodevice.html#read">read</a>().</p> <h3 class="fn"><a name="readData" />str QLocalSocket.readData (<i>self</i>, int <i>maxlen</i>)</h3><p>Reimplemented from <a href="qiodevice.html#readData">QIODevice.readData</a>().</p> <h3 class="fn"><a name="serverName" />QString QLocalSocket.serverName (<i>self</i>)</h3><p>Returns the name of the peer as specified by <a href="qlocalsocket.html#connectToServer">connectToServer</a>(), or an empty <a href="qstring.html">QString</a> if <a href="qlocalsocket.html#connectToServer">connectToServer</a>() has not been called or it failed.</p> <p><b>See also</b> <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#fullServerName">fullServerName</a>().</p> <h3 class="fn"><a name="setReadBufferSize" />QLocalSocket.setReadBufferSize (<i>self</i>, int <i>size</i>)</h3><p>Sets the size of <a href="qlocalsocket.html">QLocalSocket</a>'s internal read buffer to be <i>size</i> bytes.</p> <p>If the buffer size is limited to a certain size, <a href="qlocalsocket.html">QLocalSocket</a> won't buffer more than this size of data. Exceptionally, a buffer size of 0 means that the read buffer is unlimited and all incoming data is buffered. This is the default.</p> <p>This option is useful if you only read the data at certain points in time (e.g., in a real-time streaming application) or if you want to protect your socket against receiving too much data, which may eventually cause your application to run out of memory.</p> <p><b>See also</b> <a href="qlocalsocket.html#readBufferSize">readBufferSize</a>() and <a href="qiodevice.html#read">read</a>().</p> <h3 class="fn"><a name="setSocketDescriptor" />bool QLocalSocket.setSocketDescriptor (<i>self</i>, sip.voidptr <i>socketDescriptor</i>, <a href="qlocalsocket.html#LocalSocketState-enum">LocalSocketState</a> <i>state</i> = QLocalSocket.ConnectedState, <a href="qiodevice-openmode.html">QIODevice.OpenMode</a> <i>mode</i> = QIODevice.ReadWrite)</h3><p>Initializes <a href="qlocalsocket.html">QLocalSocket</a> with the native socket descriptor <i>socketDescriptor</i>. Returns true if socketDescriptor is accepted as a valid socket descriptor; otherwise returns false. The socket is opened in the mode specified by <i>openMode</i>, and enters the socket state specified by <i>socketState</i>.</p> <p><b>Note:</b> It is not possible to initialize two local sockets with the same native socket descriptor.</p> <p><b>See also</b> <a href="qlocalsocket.html#socketDescriptor">socketDescriptor</a>(), <a href="qlocalsocket.html#state">state</a>(), and <a href="qiodevice.html#openMode">openMode</a>().</p> <h3 class="fn"><a name="socketDescriptor" />sip.voidptr QLocalSocket.socketDescriptor (<i>self</i>)</h3><p>Returns the native socket descriptor of the <a href="qlocalsocket.html">QLocalSocket</a> object if this is available; otherwise returns -1.</p> <p>The socket descriptor is not available when <a href="qlocalsocket.html">QLocalSocket</a> is in <a href="qlocalsocket.html#LocalSocketState-enum">UnconnectedState</a>.</p> <p><b>See also</b> <a href="qlocalsocket.html#setSocketDescriptor">setSocketDescriptor</a>().</p> <h3 class="fn"><a name="state" /><a href="qlocalsocket.html#LocalSocketState-enum">LocalSocketState</a> QLocalSocket.state (<i>self</i>)</h3><p>Returns the state of the socket.</p> <p><b>See also</b> <a href="qlocalsocket.html#error">error</a>().</p> <h3 class="fn"><a name="waitForBytesWritten" />bool QLocalSocket.waitForBytesWritten (<i>self</i>, int <i>msecs</i> = 30000)</h3><p>Reimplemented from <a href="qiodevice.html#waitForBytesWritten">QIODevice.waitForBytesWritten</a>().</p> <h3 class="fn"><a name="waitForConnected" />bool QLocalSocket.waitForConnected (<i>self</i>, int <i>msecs</i> = 30000)</h3><p>Waits until the socket is connected, up to <i>msecs</i> milliseconds. If the connection has been established, this function returns true; otherwise it returns false. In the case where it returns false, you can call <a href="qlocalsocket.html#error">error</a>() to determine the cause of the error.</p> <p>The following example waits up to one second for a connection to be established:</p> <pre class="cpp"> socket<span class="operator">-</span><span class="operator">></span><a href="qlocalsocket.html#connectToServer">connectToServer</a>(<span class="string">"market"</span>); <span class="keyword">if</span> (socket<span class="operator">-</span><span class="operator">></span>waitForConnected(<span class="number">1000</span>)) <a href="qtcore.html#qDebug">qDebug</a>(<span class="string">"Connected!"</span>); </pre> <p>If <i>msecs</i> is -1, this function will not time out.</p> <p><b>See also</b> <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#connected">connected</a>().</p> <h3 class="fn"><a name="waitForDisconnected" />bool QLocalSocket.waitForDisconnected (<i>self</i>, int <i>msecs</i> = 30000)</h3><p>Waits until the socket has disconnected, up to <i>msecs</i> milliseconds. If the connection has been disconnected, this function returns true; otherwise it returns false. In the case where it returns false, you can call <a href="qlocalsocket.html#error">error</a>() to determine the cause of the error.</p> <p>The following example waits up to one second for a connection to be closed:</p> <pre class="cpp"> socket<span class="operator">-</span><span class="operator">></span><a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>(); <span class="keyword">if</span> (socket<span class="operator">-</span><span class="operator">></span>waitForDisconnected(<span class="number">1000</span>)) <a href="qtcore.html#qDebug">qDebug</a>(<span class="string">"Disconnected!"</span>); </pre> <p>If <i>msecs</i> is -1, this function will not time out.</p> <p><b>See also</b> <a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>() and <a href="qlocalsocket.html#close">close</a>().</p> <h3 class="fn"><a name="waitForReadyRead" />bool QLocalSocket.waitForReadyRead (<i>self</i>, int <i>msecs</i> = 30000)</h3><p>Reimplemented from <a href="qiodevice.html#waitForReadyRead">QIODevice.waitForReadyRead</a>().</p> <p>This function blocks until data is available for reading and the <a href="qiodevice.html#readyRead">readyRead()</a> signal has been emitted. The function will timeout after <i>msecs</i> milliseconds; the default timeout is 30000 milliseconds.</p> <p>The function returns true if data is available for reading; otherwise it returns false (if an error occurred or the operation timed out).</p> <p><b>See also</b> <a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a>().</p> <h3 class="fn"><a name="writeData" />int QLocalSocket.writeData (<i>self</i>, str)</h3><p>Reimplemented from <a href="qiodevice.html#writeData">QIODevice.writeData</a>().</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="connected" />void connected ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after <a href="qlocalsocket.html#connectToServer">connectToServer</a>() has been called and a connection has been successfully established.</p> <p><b>See also</b> <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#disconnected">disconnected</a>().</p> <h3 class="fn"><a name="disconnected" />void disconnected ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when the socket has been disconnected.</p> <p><b>See also</b> <a href="qlocalsocket.html#connectToServer">connectToServer</a>(), <a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>(), <a href="qlocalsocket.html#abort">abort</a>(), and <a href="qlocalsocket.html#connected">connected</a>().</p> <h3 class="fn"><a name="error-2" />void error (QLocalSocket::LocalSocketError)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after an error occurred. The <i>socketError</i> parameter describes the type of error that occurred.</p> <p><a href="qlocalsocket.html#LocalSocketError-enum">QLocalSocket.LocalSocketError</a> is not a registered metatype, so for queued connections, you will have to register it with <a href="qmetatype.html#Q_DECLARE_METATYPE">Q_DECLARE_METATYPE</a>() and <a href="qmetatype.html#qRegisterMetaType">qRegisterMetaType</a>().</p> <p><b>See also</b> <a href="qlocalsocket.html#error">error</a>(), <a href="qiodevice.html#errorString">errorString</a>(), and <a href="custom-types.html">Creating Custom Qt Types</a>.</p> <h3 class="fn"><a name="stateChanged" />void stateChanged (QLocalSocket::LocalSocketState)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever <a href="qlocalsocket.html">QLocalSocket</a>'s state changes. The <i>socketState</i> parameter is the new state.</p> <p>QLocalSocket.SocketState is not a registered metatype, so for queued connections, you will have to register it with <a href="qmetatype.html#Q_DECLARE_METATYPE">Q_DECLARE_METATYPE</a>() and <a href="qmetatype.html#qRegisterMetaType">qRegisterMetaType</a>().</p> <p><b>See also</b> <a href="qlocalsocket.html#state">state</a>() and <a href="custom-types.html">Creating Custom Qt Types</a>.</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>