/usr/share/qt3/doc/html/qsocketnotifier.html is in qt3-doc 3:3.3.8-b-8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qsocketnotifier.cpp:49 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSocketNotifier Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td 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="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSocketNotifier Class Reference</h1>
<p>The QSocketNotifier class provides support for socket callbacks.
<a href="#details">More...</a>
<p><tt>#include <<a href="qsocketnotifier-h.html">qsocketnotifier.h</a>></tt>
<p>Inherits <a href="qobject.html">QObject</a>.
<p><a href="qsocketnotifier-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#Type-enum"><b>Type</b></a> { Read, Write, Exception }</li>
<li class=fn><a href="#QSocketNotifier"><b>QSocketNotifier</b></a> ( int socket, Type type, QObject * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~QSocketNotifier"><b>~QSocketNotifier</b></a> ()</li>
<li class=fn>int <a href="#socket"><b>socket</b></a> () const</li>
<li class=fn>Type <a href="#type"><b>type</b></a> () const</li>
<li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
<li class=fn>virtual void <a href="#setEnabled"><b>setEnabled</b></a> ( bool enable )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#activated"><b>activated</b></a> ( int socket )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The QSocketNotifier class provides support for socket callbacks.
<p>
<p> This class makes it possible to write asynchronous socket-based
code in Qt. Using synchronous socket operations blocks the
program, which is clearly not acceptable for an event-driven GUI
program.
<p> Once you have opened a non-blocking socket (whether for TCP, UDP,
a UNIX-domain socket, or any other protocol family your operating
system supports), you can create a socket notifier to monitor the
socket. Then you connect the <a href="#activated">activated</a>() signal to the slot you
want to be called when a socket event occurs.
<p> Note for Windows users: the socket passed to QSocketNotifier will
become non-blocking, even if it was created as a blocking socket.
<p> There are three types of socket notifiers (read, write and
exception); you must specify one of these in the constructor.
<p> The type specifies when the activated() signal is to be emitted:
<ol type=1>
<li> QSocketNotifier::Read - There is data to be read (socket read event).
<li> QSocketNotifier::Write - Data can be written (socket write event).
<li> QSocketNofifier::Exception - An exception has occurred (socket
exception event). We recommend against using this.
</ol>
<p> For example, if you need to monitor both reads and writes for the
same socket you must create two socket notifiers.
<p> For read notifiers it makes little sense to connect the
activated() signal to more than one slot because the data can be
read from the socket only once.
<p> Also observe that if you do not read all the available data when
the read notifier fires, it fires again and again.
<p> For write notifiers, immediately disable the notifier after the
<a href="#activated">activated</a>() signal has been received and you have sent the data to
be written on the socket. When you have more data to be written,
enable it again to get a new activated() signal. The exception is
if the socket data writing operation (send() or equivalent) fails
with a "would block" error, which means that some buffer is full
and you must wait before sending more data. In that case you do
not need to disable and re-enable the write notifier; it will fire
again as soon as the system allows more data to be sent.
<p> The behavior of a write notifier that is left in enabled state
after having emitting the first activated() signal (and no "would
block" error has occurred) is undefined. Depending on the
operating system, it may fire on every pass of the event loop or
not at all.
<p> If you need a time-out for your sockets you can use either <a href="qobject.html#startTimer">timer events</a> or the <a href="qtimer.html">QTimer</a> class.
<p> Socket action is detected in the <a href="qapplication.html#exec">main
event loop</a> of Qt. The X11 version of Qt has a single UNIX
select() call that incorporates all socket notifiers and the X
socket.
<p> Note that on XFree86 for OS/2, select() works only in the thread
in which main() is running; you should therefore use that thread
for GUI operations.
<p> <p>See also <a href="qsocket.html">QSocket</a>, <a href="qserversocket.html">QServerSocket</a>, <a href="qsocketdevice.html">QSocketDevice</a>, <a href="qfile.html#handle">QFile::handle</a>(), and <a href="io.html">Input/Output and Networking</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="Type-enum"></a>QSocketNotifier::Type</h3>
<ul>
<li><tt>QSocketNotifier::Read</tt>
<li><tt>QSocketNotifier::Write</tt>
<li><tt>QSocketNotifier::Exception</tt>
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QSocketNotifier"></a>QSocketNotifier::QSocketNotifier ( int socket, <a href="qsocketnotifier.html#Type-enum">Type</a> type, <a href="qobject.html">QObject</a> * parent = 0, const char * name = 0 )
</h3>
Constructs a socket notifier called <em>name</em>, with the parent, <em>parent</em>. It watches <em>socket</em> for <em>type</em> events, and enables it.
<p> It is generally advisable to explicitly enable or disable the
socket notifier, especially for write notifiers.
<p> <p>See also <a href="#setEnabled">setEnabled</a>() and <a href="#isEnabled">isEnabled</a>().
<h3 class=fn><a name="~QSocketNotifier"></a>QSocketNotifier::~QSocketNotifier ()
</h3>
Destroys the socket notifier.
<h3 class=fn>void <a name="activated"></a>QSocketNotifier::activated ( int socket )<tt> [signal]</tt>
</h3>
<p> This signal is emitted under certain conditions specified by the
notifier <a href="#type">type</a>():
<ol type=1>
<li> QSocketNotifier::Read - There is data to be read (socket read event).
<li> QSocketNotifier::Write - Data can be written (socket write event).
<li> QSocketNofifier::Exception - An exception has occurred (socket
exception event).
</ol>
<p> The <em>socket</em> argument is the <a href="#socket">socket</a> identifier.
<p> <p>See also <a href="#type">type</a>() and <a href="#socket">socket</a>().
<h3 class=fn>bool <a name="isEnabled"></a>QSocketNotifier::isEnabled () const
</h3>
<p> Returns TRUE if the notifier is enabled; otherwise returns FALSE.
<p> <p>See also <a href="#setEnabled">setEnabled</a>().
<h3 class=fn>void <a name="setEnabled"></a>QSocketNotifier::setEnabled ( bool enable )<tt> [virtual]</tt>
</h3>
Enables the notifier if <em>enable</em> is TRUE or disables it if <em>enable</em> is FALSE.
<p> The notifier is enabled by default.
<p> If the notifier is enabled, it emits the <a href="#activated">activated</a>() signal
whenever a socket event corresponding to its <a href="#type">type</a> occurs. If it is disabled, it ignores socket events
(the same effect as not creating the socket notifier).
<p> Write notifiers should normally be disabled immediately after the
activated() signal has been emitted; see discussion of write
notifiers in the <a href="#details">class description</a> above.
<p> <p>See also <a href="#isEnabled">isEnabled</a>() and <a href="#activated">activated</a>().
<h3 class=fn>int <a name="socket"></a>QSocketNotifier::socket () const
</h3>
<p> Returns the socket identifier specified to the constructor.
<p> <p>See also <a href="#type">type</a>().
<h3 class=fn><a href="qsocketnotifier.html#Type-enum">Type</a> <a name="type"></a>QSocketNotifier::type () const
</h3>
<p> Returns the socket event type specified to the constructor: <a href="#Type-enum">QSocketNotifier::Read</a>, <a href="#Type-enum">QSocketNotifier::Write</a>, or <a href="#Type-enum">QSocketNotifier::Exception</a>.
<p> <p>See also <a href="#socket">socket</a>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|