Sophie

Sophie

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

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

<class name="QTcpServer" doc="/**
&lt;p&gt;The &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; class provides a TCP-based server.&lt;/p&gt;
&lt;p&gt;This class makes it possible to accept incoming TCP connections. You can specify the port or have &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; pick one automatically. You can listen on a specific address or on all the machine's addresses.&lt;/p&gt;
&lt;p&gt;Call listen() to have the server listen for incoming connections. The &lt;a href=&quot;QTcpServer.html#newConnection()&quot;&gt;&lt;tt&gt;newConnection&lt;/tt&gt;&lt;/a&gt; signal is then emitted each time a client connects to the server.&lt;/p&gt;
&lt;p&gt;Call &lt;a href=&quot;QTcpServer.html#nextPendingConnection()&quot;&gt;&lt;tt&gt;nextPendingConnection&lt;/tt&gt;&lt;/a&gt; to accept the pending connection as a connected &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt;. The function returns a pointer to a &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; in QAbstractSocket::ConnectedState that you can use for communicating with the client.&lt;/p&gt;
&lt;p&gt;If an error occurs, &lt;a href=&quot;QTcpServer.html#serverError()&quot;&gt;&lt;tt&gt;serverError&lt;/tt&gt;&lt;/a&gt; returns the type of error, and &lt;a href=&quot;QTcpServer.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt; can be called to get a human readable description of what happened.&lt;/p&gt;
&lt;p&gt;When listening for connections, the address and port on which the server is listening are available as &lt;a href=&quot;QTcpServer.html#serverAddress()&quot;&gt;&lt;tt&gt;serverAddress&lt;/tt&gt;&lt;/a&gt; and serverPort().&lt;/p&gt;
&lt;p&gt;Calling &lt;a href=&quot;QTcpServer.html#close()&quot;&gt;&lt;tt&gt;close&lt;/tt&gt;&lt;/a&gt; makes &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; stop listening for incoming connections.&lt;/p&gt;
&lt;p&gt;Although &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; is mostly designed for use with an event loop, it's possible to use it without one. In that case, you must use waitForNewConnection(), which blocks until either a connection is available or a timeout expires.&lt;/p&gt;

@see &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt;
@see Fortune Server Example&lt;/tt&gt;
@see Threaded Fortune Server Example&lt;/tt&gt;
@see Loopback Example&lt;/tt&gt;
@see Torrent Example&lt;/tt&gt; */">
    <signal name="protected final void newConnection()" doc="/**
&lt;p&gt;This signal is emitted every time a new connection is available.&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;QTcpServer.html#hasPendingConnections()&quot;&gt;&lt;tt&gt;hasPendingConnections&lt;/tt&gt;&lt;/a&gt;, &lt;a href=&quot;QTcpServer.html#nextPendingConnection()&quot;&gt;&lt;tt&gt;nextPendingConnection&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <method name="public QTcpServer(com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Constructs a &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&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;tt&gt;listen&lt;/tt&gt;
@see &lt;a href=&quot;QTcpServer.html#setSocketDescriptor(int)&quot;&gt;&lt;tt&gt;setSocketDescriptor&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public QTcpServer()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt;(0). */"/>
    <method name="public final void close()" doc="/**
&lt;p&gt;Closes the server. The server will no longer listen for incoming connections.&lt;/p&gt;

@see &lt;tt&gt;listen&lt;/tt&gt; */"/>
    <method name="public final java.lang.String errorString()" doc="/**
&lt;p&gt;Returns a human readable description of the last error that occurred.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#serverError()&quot;&gt;&lt;tt&gt;serverError&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean isListening()" doc="/**
&lt;p&gt;Returns true if the server is currently listening for incoming connections; otherwise returns false.&lt;/p&gt;

@see &lt;tt&gt;listen&lt;/tt&gt; */"/>
    <method name="public final int maxPendingConnections()" doc="/**
&lt;p&gt;Returns the maximum number of pending accepted connections. The default is 30.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#setMaxPendingConnections(int)&quot;&gt;&lt;tt&gt;setMaxPendingConnections&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTcpServer.html#hasPendingConnections()&quot;&gt;&lt;tt&gt;hasPendingConnections&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.network.QNetworkProxy proxy()" doc="/**
&lt;p&gt;Returns the network proxy for this socket. By default QNetworkProxy::DefaultProxy is used.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#setProxy(com.trolltech.qt.network.QNetworkProxy)&quot;&gt;&lt;tt&gt;setProxy&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QNetworkProxy.html&quot;&gt;&lt;tt&gt;QNetworkProxy&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.network.QHostAddress serverAddress()" doc="/**
&lt;p&gt;Returns the server's address if the server is listening for connections; otherwise returns QHostAddress::Null.&lt;/p&gt;

@see &lt;tt&gt;serverPort&lt;/tt&gt;
@see &lt;tt&gt;listen&lt;/tt&gt; */"/>
    <method name="public final com.trolltech.qt.network.QAbstractSocket.SocketError serverError()" doc="/**
&lt;p&gt;Returns an error code for the last error that occurred.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#errorString()&quot;&gt;&lt;tt&gt;errorString&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setMaxPendingConnections(int numConnections)" doc="/**
&lt;p&gt;Sets the maximum number of pending accepted connections to &lt;tt&gt;numConnections&lt;/tt&gt;. &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; will accept no more than &lt;tt&gt;numConnections&lt;/tt&gt; incoming connections before &lt;a href=&quot;QTcpServer.html#nextPendingConnection()&quot;&gt;&lt;tt&gt;nextPendingConnection&lt;/tt&gt;&lt;/a&gt; is called. By default, the limit is 30 pending connections.&lt;/p&gt;
&lt;p&gt;Clients may still able to connect after the server has reached its maximum number of pending connections (i.e&amp;#x2e;, &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; can still emit the connected() signal). &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; will stop accepting the new connections, but the operating system may still keep them in queue.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#maxPendingConnections()&quot;&gt;&lt;tt&gt;maxPendingConnections&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTcpServer.html#hasPendingConnections()&quot;&gt;&lt;tt&gt;hasPendingConnections&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setProxy(com.trolltech.qt.network.QNetworkProxy networkProxy)" doc="/**
&lt;p&gt;Sets the explicit network proxy for this socket to &lt;tt&gt;networkProxy&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;To disable the use of a proxy for this socket, use the QNetworkProxy::NoProxy proxy type:&lt;/p&gt;
&lt;pre&gt;    server-&amp;gt;setProxy(QNetworkProxy::NoProxy);&lt;/pre&gt;

@see &lt;a href=&quot;QTcpServer.html#proxy()&quot;&gt;&lt;tt&gt;proxy&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QNetworkProxy.html&quot;&gt;&lt;tt&gt;QNetworkProxy&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean setSocketDescriptor(int socketDescriptor)" doc="/**
&lt;p&gt;Sets the socket descriptor this server should use when listening for incoming connections to &lt;tt&gt;socketDescriptor&lt;/tt&gt;. Returns true if the socket is set successfully; otherwise returns false.&lt;/p&gt;
&lt;p&gt;The socket is assumed to be in listening state.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#socketDescriptor()&quot;&gt;&lt;tt&gt;socketDescriptor&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTcpServer.html#isListening()&quot;&gt;&lt;tt&gt;isListening&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int socketDescriptor()" doc="/**
&lt;p&gt;Returns the native socket descriptor the server uses to listen for incoming instructions, or -1 if the server is not listening.&lt;/p&gt;
&lt;p&gt;If the server is using &lt;a href=&quot;QNetworkProxy.html&quot;&gt;&lt;tt&gt;QNetworkProxy&lt;/tt&gt;&lt;/a&gt;, the returned descriptor may not be usable with native socket functions.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#setSocketDescriptor(int)&quot;&gt;&lt;tt&gt;setSocketDescriptor&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTcpServer.html#isListening()&quot;&gt;&lt;tt&gt;isListening&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public boolean hasPendingConnections()" doc="/**
&lt;p&gt;Returns true if the server has a pending connection; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#nextPendingConnection()&quot;&gt;&lt;tt&gt;nextPendingConnection&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTcpServer.html#setMaxPendingConnections(int)&quot;&gt;&lt;tt&gt;setMaxPendingConnections&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="protected void incomingConnection(int handle)" doc="/**
&lt;p&gt;This virtual function is called by &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; when a new connection is available. The &lt;tt&gt;handle&lt;/tt&gt; argument is the native socket descriptor for the accepted connection.&lt;/p&gt;
&lt;p&gt;The base implementation creates a &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt;, sets the socket descriptor and then stores the &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; in an internal list of pending connections. Finally &lt;a href=&quot;QTcpServer.html#newConnection()&quot;&gt;&lt;tt&gt;newConnection&lt;/tt&gt;&lt;/a&gt; is emitted.&lt;/p&gt;
&lt;p&gt;Reimplement this function to alter the server's behavior when a connection is available.&lt;/p&gt;
&lt;p&gt;If this server is using &lt;a href=&quot;QNetworkProxy.html&quot;&gt;&lt;tt&gt;QNetworkProxy&lt;/tt&gt;&lt;/a&gt; then the &lt;tt&gt;handle&lt;/tt&gt; may not be usable with native socket functions, and should only be used with QTcpSocket::setSocketDescriptor().&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#newConnection()&quot;&gt;&lt;tt&gt;newConnection&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QTcpServer.html#nextPendingConnection()&quot;&gt;&lt;tt&gt;nextPendingConnection&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public com.trolltech.qt.network.QTcpSocket nextPendingConnection()" doc="/**
&lt;p&gt;Returns the next pending connection as a connected &lt;a href=&quot;QTcpSocket.html&quot;&gt;&lt;tt&gt;QTcpSocket&lt;/tt&gt;&lt;/a&gt; object.&lt;/p&gt;
&lt;p&gt;The socket is created as a child of the server, which means that it is automatically deleted when the &lt;a href=&quot;QTcpServer.html#QTcpServer(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QTcpServer&lt;/tt&gt;&lt;/a&gt; object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.&lt;/p&gt;
&lt;p&gt;0 is returned if this function is called when there are no pending connections.&lt;/p&gt;

@see &lt;a href=&quot;QTcpServer.html#hasPendingConnections()&quot;&gt;&lt;tt&gt;hasPendingConnections&lt;/tt&gt;&lt;/a&gt; */"/>
</class>