Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2435

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

<class name="QUdpSocket" doc="/**
&lt;p&gt;The &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; class provides a UDP socket.&lt;/p&gt;
&lt;p&gt;UDP (User Datagram Protocol) is a lightweight, unreliable, datagram-oriented, connectionless protocol. It can be used when reliability isn't important. &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; is a subclass of &lt;a href=&quot;QAbstractSocket.html#QAbstractSocket(com.trolltech.qt.network.QAbstractSocket.SocketType, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QAbstractSocket&lt;/tt&gt;&lt;/a&gt; that allows you to send and receive UDP datagrams.&lt;/p&gt;
&lt;p&gt;The most common way to use this class is to bind to an address and port using bind(), then call writeDatagram() and readDatagram() to transfer data. If you want to use the standard &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#QIODevice(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QIODevice&lt;/tt&gt;&lt;/a&gt; functions &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#read(long)&quot;&gt;&lt;tt&gt;read&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#readLine(long)&quot;&gt;&lt;tt&gt;readLine&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#write(com.trolltech.qt.core.QByteArray)&quot;&gt;&lt;tt&gt;write&lt;/tt&gt;&lt;/a&gt;, etc., you must first connect the socket directly to a peer by calling connectToHost().&lt;/p&gt;
&lt;p&gt;The socket emits the &lt;a href=&quot;QUdpSocket.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt; signal every time a datagram is written to the network. If you just want to send datagrams, you don't need to call bind().&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;QUdpSocket.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; signal is emitted whenever datagrams arrive. In that case, &lt;a href=&quot;QUdpSocket.html#hasPendingDatagrams()&quot;&gt;&lt;tt&gt;hasPendingDatagrams&lt;/tt&gt;&lt;/a&gt; returns true. Call &lt;a href=&quot;QUdpSocket.html#pendingDatagramSize()&quot;&gt;&lt;tt&gt;pendingDatagramSize&lt;/tt&gt;&lt;/a&gt; to obtain the size of the first pending datagram, and readDatagram() to read it.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;    void Server::initSocket()
    {
        udpSocket = new QUdpSocket(this);
        udpSocket-&amp;gt;bind(QHostAddress::LocalHost, 7755);

        connect(udpSocket, SIGNAL(readyRead()),
                this, SLOT(readPendingDatagrams()));
    }

    void Server::readPendingDatagrams()
    {
        while (udpSocket-&amp;gt;hasPendingDatagrams()) {
            QByteArray datagram;
            datagram.resize(udpSocket-&amp;gt;pendingDatagramSize());
            QHostAddress sender;
            quint16 senderPort;

            udpSocket-&amp;gt;readDatagram(datagram.data(), datagram.size(),
                                    &amp;amp;sender, &amp;amp;senderPort);

            processTheDatagram(datagram);
        }
    }&lt;/pre&gt;
&lt;p&gt;With &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt;, you can also establish a virtual connection to a UDP server using connectToHost() and then use &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#read(long)&quot;&gt;&lt;tt&gt;read&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#write(com.trolltech.qt.core.QByteArray)&quot;&gt;&lt;tt&gt;write&lt;/tt&gt;&lt;/a&gt; to exchange datagrams without specifying the receiver for each datagram.&lt;/p&gt;
&lt;p&gt;The Broadcast Sender&lt;/tt&gt; and Broadcast Receiver&lt;/tt&gt; examples illustrate how to use &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; in applications.&lt;/p&gt;

@see &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; */">
    <signal name="protected final void aboutToClose()" doc="/**
&lt;p&gt;This signal is emitted when the device is about to close. Connect this signal if you have operations that need to be performed before the device closes (e.g&amp;#x2e;, if you have data in a separate buffer that needs to be written to the device).&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void bytesWritten(long bytes)" doc="/**
&lt;p&gt;This signal is emitted every time a payload of data has been written to the device. The &lt;tt&gt;bytes&lt;/tt&gt; argument is set to the number of bytes that were written in this payload.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QUdpSocket.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt; is not emitted recursively; if you reenter the event loop or call &lt;a href=&quot;QAbstractSocket.html#waitForBytesWritten(int)&quot;&gt;&lt;tt&gt;waitForBytesWritten&lt;/tt&gt;&lt;/a&gt; inside a slot connected to the &lt;a href=&quot;QUdpSocket.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt; signal, the signal will not be reemitted (although &lt;a href=&quot;QAbstractSocket.html#waitForBytesWritten(int)&quot;&gt;&lt;tt&gt;waitForBytesWritten&lt;/tt&gt;&lt;/a&gt; may still return true).&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(long bytes)&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;QUdpSocket.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void connected()" doc="/**
&lt;p&gt;This signal is emitted after connectToHost() has been called and a connection has been successfully established.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&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;tt&gt;connectToHost&lt;/tt&gt;, &lt;a href=&quot;QUdpSocket.html#disconnected()&quot;&gt;&lt;tt&gt;disconnected&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void disconnected()" doc="/**
&lt;p&gt;This signal is emitted when the socket has been disconnected.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&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;tt&gt;connectToHost&lt;/tt&gt;, &lt;a href=&quot;QAbstractSocket.html#disconnectFromHost()&quot;&gt;&lt;tt&gt;disconnectFromHost&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QAbstractSocket.html#abort()&quot;&gt;&lt;tt&gt;abort&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void error(com.trolltech.qt.network.QAbstractSocket.SocketError arg__1)" doc="/**
&lt;p&gt;This signal is emitted after an error occurred. The &lt;tt&gt;arg__1&lt;/tt&gt; parameter describes the type of error that occurred.&lt;/p&gt;
&lt;p&gt;QAbstractSocket::SocketError is not a registered metatype, so for queued connections, you will have to register it with Q_REGISTER_METATYPE.&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(com.trolltech.qt.network.QAbstractSocket.SocketError arg__1)&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;QUdpSocket.html#error(com.trolltech.qt.network.QAbstractSocket.SocketError)&quot;&gt;&lt;tt&gt;error&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QIODevice.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void hostFound()" doc="/**
&lt;p&gt;This signal is emitted after connectToHost() has been called and the host lookup has succeeded.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&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;QUdpSocket.html#connected()&quot;&gt;&lt;tt&gt;connected&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void proxyAuthenticationRequiredPrivate(com.trolltech.qt.network.QNetworkProxy proxy, com.trolltech.qt.network.QAuthenticator authenticator)" doc="/**
&lt;p&gt;This signal can be emitted when a &lt;tt&gt;proxy&lt;/tt&gt; that requires authentication is used. The &lt;tt&gt;authenticator&lt;/tt&gt; object can then be filled in with the required details to allow authentication and continue the connection.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; It is not possible to use a QueuedConnection to connect to this signal, as the connection will fail if the authenticator has not been filled in with new information when the signal returns.&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(com.trolltech.qt.network.QNetworkProxy proxy, com.trolltech.qt.network.QAuthenticator authenticator)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(com.trolltech.qt.network.QNetworkProxy proxy)&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;QAuthenticator.html&quot;&gt;&lt;tt&gt;QAuthenticator&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QNetworkProxy.html&quot;&gt;&lt;tt&gt;QNetworkProxy&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void readyRead()" doc="/**
&lt;p&gt;This signal is emitted once every time new data is available for reading from the device. It will only be emitted again once new data is available, such as when a new payload of network data has arrived on your network socket, or when a new block of data has been appended to your device.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QUdpSocket.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; is not emitted recursively; if you reenter the event loop or call &lt;a href=&quot;QAbstractSocket.html#waitForReadyRead(int)&quot;&gt;&lt;tt&gt;waitForReadyRead&lt;/tt&gt;&lt;/a&gt; inside a slot connected to the &lt;a href=&quot;QUdpSocket.html#readyRead()&quot;&gt;&lt;tt&gt;readyRead&lt;/tt&gt;&lt;/a&gt; signal, the signal will not be reemitted (although &lt;a href=&quot;QAbstractSocket.html#waitForReadyRead(int)&quot;&gt;&lt;tt&gt;waitForReadyRead&lt;/tt&gt;&lt;/a&gt; may still return true).&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signature:&lt;/b&gt;&lt;/dt&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;QUdpSocket.html#bytesWritten(long)&quot;&gt;&lt;tt&gt;bytesWritten&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void stateChanged(com.trolltech.qt.network.QAbstractSocket.SocketState arg__1)" doc="/**
&lt;p&gt;This signal is emitted whenever &lt;a href=&quot;QAbstractSocket.html#QAbstractSocket(com.trolltech.qt.network.QAbstractSocket.SocketType, com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QAbstractSocket&lt;/tt&gt;&lt;/a&gt;'s state changes. The &lt;tt&gt;arg__1&lt;/tt&gt; parameter is the new state.&lt;/p&gt;
&lt;p&gt;QAbstractSocket::SocketState is not a registered metatype, so for queued connections, you will have to register it with Q_REGISTER_METATYPE.&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(com.trolltech.qt.network.QAbstractSocket.SocketState arg__1)&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;QAbstractSocket.html#state()&quot;&gt;&lt;tt&gt;state&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <method name="public QUdpSocket(com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Creates a &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;parent&lt;/tt&gt; is passed to the &lt;a href=&quot;%2E%2E/core/%2E%2E/core/QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; constructor.&lt;/p&gt;

@see &lt;a href=&quot;QAbstractSocket.html#socketType()&quot;&gt;&lt;tt&gt;socketType&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public QUdpSocket()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt;(0). */"/>
    <method name="public final boolean hasPendingDatagrams()" doc="/**
&lt;p&gt;Returns true if at least one datagram is waiting to be read; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QUdpSocket.html#pendingDatagramSize()&quot;&gt;&lt;tt&gt;pendingDatagramSize&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;readDatagram&lt;/tt&gt; */"/>
    <method name="public final long pendingDatagramSize()" doc="/**
&lt;p&gt;Returns the size of the first pending UDP datagram. If there is no datagram available, this function returns -1.&lt;/p&gt;

@see &lt;a href=&quot;QUdpSocket.html#hasPendingDatagrams()&quot;&gt;&lt;tt&gt;hasPendingDatagrams&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;readDatagram&lt;/tt&gt; */"/>
    <enum name="BindFlag" doc="/**
&lt;p&gt;This enum describes the different flags you can pass to modify the behavior of QUdpSocket::bind().&lt;/p&gt;
 */">
        <enum-value name="DefaultForPlatform" doc="/**
&lt;p&gt;The default option for the current platform. On Unix and Mac OS X, this is equivalent to (&lt;a href=&quot;QUdpSocket.html#BindFlag-enum&quot;&gt;&lt;tt&gt;DontShareAddress&lt;/tt&gt;&lt;/a&gt; + &lt;a href=&quot;QUdpSocket.html#BindFlag-enum&quot;&gt;&lt;tt&gt;ReuseAddressHint&lt;/tt&gt;&lt;/a&gt;), and on Windows, its equivalent to &lt;a href=&quot;QUdpSocket.html#BindFlag-enum&quot;&gt;&lt;tt&gt;ShareAddress&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
 */"/>
        <enum-value name="ShareAddress" doc="/**
&lt;p&gt;Allow other services to bind to the same address and port. This is useful when multiple processes share the load of a single service by listening to the same address and port (e.g&amp;#x2e;, a web server with several pre-forked listeners can greatly improve response time). However, because any service is allowed to rebind, this option is subject to certain security considerations. Note that by combining this option with &lt;a href=&quot;QUdpSocket.html#BindFlag-enum&quot;&gt;&lt;tt&gt;ReuseAddressHint&lt;/tt&gt;&lt;/a&gt;, you will also allow your service to rebind an existing shared address. On Unix, this is equivalent to the SO_REUSEADDR socket option. On Windows, this option is ignored.&lt;/p&gt;
 */"/>
        <enum-value name="DontShareAddress" doc="/**
&lt;p&gt;Bind the address and port exclusively, so that no other services are allowed to rebind. By passing this option to QUdpSocket::bind(), you are guaranteed that on successs, your service is the only one that listens to the address and port. No services are allowed to rebind, even if they pass &lt;a href=&quot;QUdpSocket.html#BindFlag-enum&quot;&gt;&lt;tt&gt;ReuseAddressHint&lt;/tt&gt;&lt;/a&gt;. This option provides more security than &lt;a href=&quot;QUdpSocket.html#BindFlag-enum&quot;&gt;&lt;tt&gt;ShareAddress&lt;/tt&gt;&lt;/a&gt;, but on certain operating systems, it requires you to run the server with administrator privileges. On Unix and Mac OS X, not sharing is the default behavior for binding an address and port, so this option is ignored. On Windows, this option uses the SO_EXCLUSIVEADDRUSE socket option.&lt;/p&gt;
 */"/>
        <enum-value name="ReuseAddressHint" doc="/**
&lt;p&gt;Provides a hint to &lt;a href=&quot;QUdpSocket.html#QUdpSocket(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QUdpSocket&lt;/tt&gt;&lt;/a&gt; that it should try to rebind the service even if the address and port are already bound by another socket. On Windows, this is equivalent to the SO_REUSEADDR socket option. On Unix, this option is ignored.&lt;/p&gt;
 */"/>
</enum>
</class>