File: qlocalsocket.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (143 lines) | stat: -rw-r--r-- 27,604 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.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">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&#160;<i>parent</i>&#160;=&#160;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, QIODevice.OpenMode&#160;<i>mode</i>&#160;=&#160;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&#160;<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)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#setSocketDescriptor">setSocketDescriptor</a></b> (<i>self</i>, sip.voidptr, LocalSocketState&#160;<i>state</i>&#160;=&#160;QLocalSocket.ConnectedState, QIODevice.OpenMode&#160;<i>mode</i>&#160;=&#160;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&#160;<i>msecs</i>&#160;=&#160;30000)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForConnected">waitForConnected</a></b> (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;30000)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForDisconnected">waitForDisconnected</a></b> (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;30000)</li><li><div class="fn" />bool <b><a href="qlocalsocket.html#waitForReadyRead">waitForReadyRead</a></b> (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;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>
<p>See also <a href="qlocalserver.html">QLocalServer</a>.</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>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QLocalSocket.ConnectionRefusedError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.ConnectionRefusedError</tt></td><td valign="top">The connection was refused by the peer (or timed out).</td></tr>
<tr><td valign="top"><tt>QLocalSocket.PeerClosedError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.RemoteHostClosedError</tt></td><td valign="top">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 valign="top"><tt>QLocalSocket.ServerNotFoundError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.HostNotFoundError</tt></td><td valign="top">The local socket name was not found.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.SocketAccessError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.SocketAccessError</tt></td><td valign="top">The socket operation failed because the application lacked the required privileges.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.SocketResourceError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.SocketResourceError</tt></td><td valign="top">The local system ran out of resources (e.g., too many sockets).</td></tr>
<tr><td valign="top"><tt>QLocalSocket.SocketTimeoutError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.SocketTimeoutError</tt></td><td valign="top">The socket operation timed out.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.DatagramTooLargeError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.DatagramTooLargeError</tt></td><td valign="top">The datagram was larger than the operating system's limit (which can be as low as 8192 bytes).</td></tr>
<tr><td valign="top"><tt>QLocalSocket.ConnectionError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.NetworkError</tt></td><td valign="top">An error occurred with the connection.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.UnsupportedSocketOperationError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.UnsupportedSocketOperationError</tt></td><td valign="top">The requested socket operation is not supported by the local operating system.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.UnknownSocketError</tt></td><td align="center" valign="top"><tt>QAbstractSocket.UnknownSocketError</tt></td><td valign="top">An unidentified error occurred.</td></tr>
</table></p>
<a name="//apple_ref/cpp/tag/QLocalSocket/LocalSocketState" />
<a name="//apple_ref/cpp/econst/QLocalSocket/UnconnectedState" />
<a name="//apple_ref/cpp/econst/QLocalSocket/ConnectingState" />
<a name="//apple_ref/cpp/econst/QLocalSocket/ConnectedState" />
<a name="//apple_ref/cpp/econst/QLocalSocket/ClosingState" />
<h3 class="fn"><a name="LocalSocketState-enum" />QLocalSocket.LocalSocketState</h3><p>This enum describes the different states in which a socket can be.</p>
<p><table border="1" cellpadding="2" cellspacing="1" class="valuelist" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QLocalSocket.UnconnectedState</tt></td><td align="center" valign="top"><tt>QAbstractSocket.UnconnectedState</tt></td><td valign="top">The socket is not connected.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.ConnectingState</tt></td><td align="center" valign="top"><tt>QAbstractSocket.ConnectingState</tt></td><td valign="top">The socket has started establishing a connection.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.ConnectedState</tt></td><td align="center" valign="top"><tt>QAbstractSocket.ConnectedState</tt></td><td valign="top">A connection is established.</td></tr>
<tr><td valign="top"><tt>QLocalSocket.ClosingState</tt></td><td align="center" valign="top"><tt>QAbstractSocket.ClosingState</tt></td><td valign="top">The socket is about to close (data may still be waiting to be written).</td></tr>
</table></p>
<p>See also <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>&#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>Creates a new local socket. The <i>parent</i> argument is passed to <a href="qobject.html">QObject</a>'s constructor.</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/~QLocalSocket" />
<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>See also <a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>() and <a href="qlocalsocket.html#close">close</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/bytesAvailable" />
<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>
<a name="//apple_ref/cpp/instm/QLocalSocket/bytesToWrite" />
<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>
<a name="//apple_ref/cpp/instm/QLocalSocket/canReadLine" />
<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>
<a name="//apple_ref/cpp/instm/QLocalSocket/close" />
<h3 class="fn"><a name="close" />QLocalSocket.close (<i>self</i>)</h3><p>Reimplemented from <a href="qiodevice.html#close">QIODevice.close</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/connectToServer" />
<h3 class="fn"><a name="connectToServer" />QLocalSocket.connectToServer (<i>self</i>, QString, <a href="qiodevice-openmode.html">QIODevice.OpenMode</a>&#160;<i>mode</i>&#160;=&#160;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>
<a name="//apple_ref/cpp/instm/QLocalSocket/connected" />
<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>See also <a href="qlocalsocket.html#connectToServer">connectToServer</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/disconnected" />
<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>See also <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>See also <a href="qiodevice.html#write">write</a>() and <a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/fullServerName" />
<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>See also <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#serverName">serverName</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/isSequential" />
<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>
<a name="//apple_ref/cpp/instm/QLocalSocket/isValid" />
<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>See also <a href="qlocalsocket.html#state">state</a>() and <a href="qlocalsocket.html#connectToServer">connectToServer</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/readBufferSize" />
<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>See also <a href="qlocalsocket.html#setReadBufferSize">setReadBufferSize</a>() and <a href="qiodevice.html#read">read</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/readData" />
<h3 class="fn"><a name="readData" />str QLocalSocket.readData (<i>self</i>, int&#160;<i>maxlen</i>)</h3><p>Reimplemented from <a href="qiodevice.html#readData">QIODevice.readData</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/serverName" />
<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>See also <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#fullServerName">fullServerName</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/setReadBufferSize" />
<h3 class="fn"><a name="setReadBufferSize" />QLocalSocket.setReadBufferSize (<i>self</i>, int)</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>See also <a href="qlocalsocket.html#readBufferSize">readBufferSize</a>() and <a href="qiodevice.html#read">read</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/setSocketDescriptor" />
<h3 class="fn"><a name="setSocketDescriptor" />bool QLocalSocket.setSocketDescriptor (<i>self</i>, sip.voidptr, <a href="qlocalsocket.html#LocalSocketState-enum">LocalSocketState</a>&#160;<i>state</i>&#160;=&#160;QLocalSocket.ConnectedState, <a href="qiodevice-openmode.html">QIODevice.OpenMode</a>&#160;<i>mode</i>&#160;=&#160;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>See also <a href="qlocalsocket.html#socketDescriptor">socketDescriptor</a>(), <a href="qlocalsocket.html#state">state</a>(), and <a href="qiodevice.html#openMode">openMode</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/socketDescriptor" />
<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>See also <a href="qlocalsocket.html#setSocketDescriptor">setSocketDescriptor</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/state" />
<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>See also <a href="qlocalsocket.html#error">error</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/stateChanged" />
<h3 class="fn"><a name="waitForBytesWritten" />bool QLocalSocket.waitForBytesWritten (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;30000)</h3><p>Reimplemented from <a href="qiodevice.html#waitForBytesWritten">QIODevice.waitForBytesWritten</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/waitForConnected" />
<h3 class="fn"><a name="waitForConnected" />bool QLocalSocket.waitForConnected (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;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> socket-&gt;connectToServer("market");
 if (socket-&gt;waitForConnected(1000))
     qDebug("Connected!");</pre>
<p>If <i>msecs</i> is -1, this function will not time out.</p>
<p>See also <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#connected">connected</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/waitForDisconnected" />
<h3 class="fn"><a name="waitForDisconnected" />bool QLocalSocket.waitForDisconnected (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;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> socket-&gt;disconnectFromServer();
 if (socket-&gt;waitForDisconnected(1000))
     qDebug("Disconnected!");</pre>
<p>If <i>msecs</i> is -1, this function will not time out.</p>
<p>See also <a href="qlocalsocket.html#disconnectFromServer">disconnectFromServer</a>() and <a href="qlocalsocket.html#close">close</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/waitForReadyRead" />
<h3 class="fn"><a name="waitForReadyRead" />bool QLocalSocket.waitForReadyRead (<i>self</i>, int&#160;<i>msecs</i>&#160;=&#160;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>See also <a href="qlocalsocket.html#waitForBytesWritten">waitForBytesWritten</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/writeData" />
<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>
<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>See also <a href="qlocalsocket.html#connectToServer">connectToServer</a>() and <a href="qlocalsocket.html#disconnected">disconnected</a>().</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/disconnectFromServer" />
<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>See also <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>
<a name="//apple_ref/cpp/instm/QLocalSocket/error" />
<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>See also <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>
<a name="//apple_ref/cpp/instm/QLocalSocket/flush" />
<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>See also <a href="qlocalsocket.html#state">state</a>() and <a href="custom-types.html">Creating Custom Qt Types</a>.</p>
<a name="//apple_ref/cpp/instm/QLocalSocket/waitForBytesWritten" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.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> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>