Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2196

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QSocketNotifier" doc="/**
&lt;p&gt;The &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt; class provides support for monitoring activity on a file descriptor.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt; makes it possible to integrate Qt's event loop with other event loops based on file descriptors. For example, the CORBA Framework&lt;/tt&gt; uses it to process CORBA events. File descriptor action is detected in Qt's main event loop (QCoreApplication::exec()).&lt;/p&gt;
&lt;a name=&quot;write-notifiers&quot;&gt;&lt;/a&gt;&lt;p&gt;Once you have opened a device using a low-level (usually platform-specific) API, you can create a socket notifier to monitor the file descriptor. The socket notifier is enabled by default, i.e&amp;#x2e; it emits the &lt;a href=&quot;QSocketNotifier.html#activated(int)&quot;&gt;&lt;tt&gt;activated&lt;/tt&gt;&lt;/a&gt; signal whenever a socket event corresponding to its type occurs. Connect the &lt;a href=&quot;QSocketNotifier.html#activated(int)&quot;&gt;&lt;tt&gt;activated&lt;/tt&gt;&lt;/a&gt; signal to the slot you want to be called when an event corresponding to your socket notifier's type occurs.&lt;/p&gt;
&lt;p&gt;There are three types of socket notifiers: read, write, and exception. The type is described by the &lt;a href=&quot;QSocketNotifier.html#Type-enum&quot;&gt;Type&lt;/tt&gt;&lt;/a&gt; enum, and must be specified when constructing the socket notifier. After construction it can be determined using the &lt;a href=&quot;QSocketNotifier.html#type()&quot;&gt;&lt;tt&gt;type&lt;/tt&gt;&lt;/a&gt; function. Note that if you need to monitor both reads and writes for the same file descriptor, you must create two socket notifiers. Note also that it is not possible to install two socket notifiers of the same type (&lt;a href=&quot;QSocketNotifier.html#Type-enum&quot;&gt;Read&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QSocketNotifier.html#Type-enum&quot;&gt;Write&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QSocketNotifier.html#Type-enum&quot;&gt;Exception&lt;/tt&gt;&lt;/a&gt;) on the same socket.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;QSocketNotifier.html#setEnabled(boolean)&quot;&gt;&lt;tt&gt;setEnabled&lt;/tt&gt;&lt;/a&gt; function allows you to disable as well as enable the socket notifier. It is generally advisable to explicitly enable or disable the socket notifier, especially for write notifiers. A disabled notifier ignores socket events (the same effect as not creating the socket notifier). Use the &lt;a href=&quot;QSocketNotifier.html#isEnabled()&quot;&gt;&lt;tt&gt;isEnabled&lt;/tt&gt;&lt;/a&gt; function to determine the notifier's current status.&lt;/p&gt;
&lt;p&gt;Finally, you can use the &lt;a href=&quot;QSocketNotifier.html#socket()&quot;&gt;&lt;tt&gt;socket&lt;/tt&gt;&lt;/a&gt; function to retrieve the socket identifier. Although the class is called &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt;, it is normally used for other types of devices than sockets. &lt;a href=&quot;%2E%2E/network/QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;%2E%2E/network/QUdpSocket.html&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; provide notification through signals, so there is normally no need to use a &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt; on them.&lt;/p&gt;
&lt;a name=&quot;notes-for-windows-users&quot;&gt;&lt;/a&gt;
&lt;h3&gt;Notes for Windows Users&lt;/h3&gt;
&lt;p&gt;The socket passed to &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt; will become non-blocking, even if it was created as a blocking socket. The &lt;a href=&quot;QSocketNotifier.html#activated(int)&quot;&gt;&lt;tt&gt;activated&lt;/tt&gt;&lt;/a&gt; signal is sometimes triggered by high general activity on the host, even if there is nothing to read. A subsequent read from the socket can then fail, the error indicating that there is no data available (e.g&amp;#x2e;, &lt;tt&gt;WSAEWOULDBLOCK&lt;/tt&gt;). This is an operating system limitation, and not a bug in &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To ensure that the socket notifier handles read notifications correctly, follow these steps when you receive a notification:&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;Disable the notifier.&lt;/li&gt;
&lt;li&gt;Read data from the socket.&lt;/li&gt;
&lt;li&gt;Re-enable the notifier if you are interested in more data (such as after having written a new command to a remote server).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;To ensure that the socket notifier handles write notifications correctly, follow these steps when you receive a notification:&lt;/p&gt;
&lt;ol type=&quot;1&quot;&gt;
&lt;li&gt;Disable the notifier.&lt;/li&gt;
&lt;li&gt;Write as much data as you can (before &lt;tt&gt;EWOULDBLOCK&lt;/tt&gt; is returned).&lt;/li&gt;
&lt;li&gt;Re-enable notifier if you have more data to write.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;b&gt;Further information:&lt;/b&gt; On Windows, Qt always disables the notifier after getting a notification, and only re-enables it if more data is expected. For example, if data is read from the socket and it can be used to read more, or if reading or writing is not possible because the socket would block, in which case it is necessary to wait before attempting to read or write again.&lt;/p&gt;

@see &lt;a href=&quot;QFile.html&quot;&gt;&lt;tt&gt;QFile&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QProcess.html&quot;&gt;&lt;tt&gt;QProcess&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/network/QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/network/QUdpSocket.html&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; */">
    <signal name="protected final void activated(int socket)" doc="/**
&lt;p&gt;This signal is emitted whenever the socket notifier is enabled and a socket event corresponding to its &lt;a href=&quot;QSocketNotifier.html#Type-enum&quot;&gt;type&lt;/tt&gt;&lt;/a&gt; occurs.&lt;/p&gt;
&lt;p&gt;The socket identifier is passed in the &lt;tt&gt;socket&lt;/tt&gt; parameter.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(int socket)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QSocketNotifier.html#type()&quot;&gt;&lt;tt&gt;type&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QSocketNotifier.html#socket()&quot;&gt;&lt;tt&gt;socket&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <method name="public QSocketNotifier(int socket, com.trolltech.qt.core.QSocketNotifier.Type arg__2, com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Constructs a socket notifier with the given &lt;tt&gt;parent&lt;/tt&gt;. It enables the &lt;tt&gt;socket&lt;/tt&gt;, and watches for events of the given &lt;tt&gt;arg__2&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;It is generally advisable to explicitly enable or disable the socket notifier, especially for write notifiers.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note for Windows users:&lt;/b&gt; The socket passed to &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt; will become non-blocking, even if it was created as a blocking socket.&lt;/p&gt;

@see &lt;a href=&quot;QSocketNotifier.html#setEnabled(boolean)&quot;&gt;&lt;tt&gt;setEnabled&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSocketNotifier.html#isEnabled()&quot;&gt;&lt;tt&gt;isEnabled&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public QSocketNotifier(int socket, com.trolltech.qt.core.QSocketNotifier.Type arg__2)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;socket&lt;/tt&gt;, &lt;tt&gt;arg__2&lt;/tt&gt;, 0). */"/>
    <method name="public final boolean isEnabled()" doc="/**
&lt;p&gt;Returns true if the notifier is enabled; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QSocketNotifier.html#setEnabled(boolean)&quot;&gt;&lt;tt&gt;setEnabled&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setEnabled(boolean arg__1)" doc="/**
&lt;p&gt;If &lt;tt&gt;arg__1&lt;/tt&gt; is true, the notifier is enabled; otherwise the notifier is disabled.&lt;/p&gt;
&lt;p&gt;The notifier is enabled by default, i.e&amp;#x2e; it emits the &lt;a href=&quot;QSocketNotifier.html#activated(int)&quot;&gt;&lt;tt&gt;activated&lt;/tt&gt;&lt;/a&gt; signal whenever a socket event corresponding to its &lt;a href=&quot;QSocketNotifier.html#type()&quot;&gt;type&lt;/tt&gt;&lt;/a&gt; occurs. If it is disabled, it ignores socket events (the same effect as not creating the socket notifier).&lt;/p&gt;
&lt;p&gt;Write notifiers should normally be disabled immediately after the &lt;a href=&quot;QSocketNotifier.html#activated(int)&quot;&gt;&lt;tt&gt;activated&lt;/tt&gt;&lt;/a&gt; signal has been emitted&lt;/p&gt;

@see &lt;a href=&quot;QSocketNotifier.html#isEnabled()&quot;&gt;&lt;tt&gt;isEnabled&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSocketNotifier.html#activated(int)&quot;&gt;&lt;tt&gt;activated&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int socket()" doc="/**
&lt;p&gt;Returns the socket identifier specified to the constructor.&lt;/p&gt;

@see &lt;a href=&quot;QSocketNotifier.html#type()&quot;&gt;&lt;tt&gt;type&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.core.QSocketNotifier.Type type()" doc="/**
&lt;p&gt;Returns the socket event type specified to the constructor.&lt;/p&gt;

@see &lt;a href=&quot;QSocketNotifier.html#socket()&quot;&gt;&lt;tt&gt;socket&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean event(com.trolltech.qt.core.QEvent arg__1)" doc="/**
&lt;p&gt;This function is reimplemented for internal reasons.&lt;/p&gt;
 */"/>
    <enum name="Type" doc="/**
&lt;p&gt;This enum describes the various types of events that a socket notifier can recognize. The type must be specified when constructing the socket notifier.&lt;/p&gt;
&lt;p&gt;Note that if you need to monitor both reads and writes for the same file descriptor, you must create two socket notifiers. Note also that it is not possible to install two socket notifiers of the same type (Read, Write, Exception) on the same socket.&lt;/p&gt;

@see &lt;a href=&quot;QSocketNotifier.html#QSocketNotifier(int, com.trolltech.qt.core.QSocketNotifier.Type, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSocketNotifier&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSocketNotifier.html#type()&quot;&gt;&lt;tt&gt;type&lt;/tt&gt;&lt;/a&gt; */">
        <enum-value name="Read" doc="/**
&lt;p&gt;There is data to be read.&lt;/p&gt;
 */"/>
        <enum-value name="Write" doc="/**
&lt;p&gt;Data can be written.&lt;/p&gt;
 */"/>
        <enum-value name="Exception" doc="/**
&lt;p&gt;An exception has occurred. We recommend against using this.&lt;/p&gt;
 */"/>
</enum>
</class>