Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 6722

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qtcpserver.cpp -->
  <title>Qt 4.8: QTcpServer Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtnetwork.html">QtNetwork</a></li>
<li>QTcpServer</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#symbian-platform-security-requirements">Symbian Platform Security Requirements</a></li>
</ul>
</div>
<h1 class="title">QTcpServer Class Reference</h1>
<!-- $$$QTcpServer-brief -->
<p>The QTcpServer class provides a TCP-based server. <a href="#details">More...</a></p>
<!-- @@@QTcpServer -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QTcpServer&gt;</span></pre><p><b>Inherits: </b><a href="qobject.html">QObject</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qtcpserver-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#QTcpServer">QTcpServer</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#dtor.QTcpServer">~QTcpServer</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#close">close</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#errorString">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#hasPendingConnections">hasPendingConnections</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#isListening">isListening</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#listen">listen</a></b> ( const QHostAddress &amp; <i>address</i> = QHostAddress::Any, quint16 <i>port</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#maxPendingConnections">maxPendingConnections</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QTcpSocket * </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QNetworkProxy </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#proxy">proxy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QHostAddress </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#serverAddress">serverAddress</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAbstractSocket::SocketError </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#serverError">serverError</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint16 </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#serverPort">serverPort</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#setMaxPendingConnections">setMaxPendingConnections</a></b> ( int <i>numConnections</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#setProxy">setProxy</a></b> ( const QNetworkProxy &amp; <i>networkProxy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#setSocketDescriptor">setSocketDescriptor</a></b> ( int <i>socketDescriptor</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#socketDescriptor">socketDescriptor</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#waitForNewConnection">waitForNewConnection</a></b> ( int <i>msec</i> = 0, bool * <i>timedOut</i> = 0 )</td></tr>
</table>
<ul>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#newConnection">newConnection</a></b> ()</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#addPendingConnection">addPendingConnection</a></b> ( QTcpSocket * <i>socket</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qtcpserver.html#incomingConnection">incomingConnection</a></b> ( int <i>socketDescriptor</i> )</td></tr>
</table>
<ul>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QTcpServer-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QTcpServer class provides a TCP-based server.</p>
<p>This class makes it possible to accept incoming TCP connections. You can specify the port or have QTcpServer pick one automatically. You can listen on a specific address or on all the machine's addresses.</p>
<p>Call <a href="qtcpserver.html#listen">listen</a>() to have the server listen for incoming connections. The <a href="qtcpserver.html#newConnection">newConnection</a>() signal is then emitted each time a client connects to the server.</p>
<p>Call <a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a>() to accept the pending connection as a connected <a href="qtcpsocket.html">QTcpSocket</a>. The function returns a pointer to a <a href="qtcpsocket.html">QTcpSocket</a> in <a href="qabstractsocket.html#SocketState-enum">QAbstractSocket::ConnectedState</a> that you can use for communicating with the client.</p>
<p>If an error occurs, <a href="qtcpserver.html#serverError">serverError</a>() returns the type of error, and <a href="qtcpserver.html#errorString">errorString</a>() can be called to get a human readable description of what happened.</p>
<p>When listening for connections, the address and port on which the server is listening are available as <a href="qtcpserver.html#serverAddress">serverAddress</a>() and <a href="qtcpserver.html#serverPort">serverPort</a>().</p>
<p>Calling <a href="qtcpserver.html#close">close</a>() makes QTcpServer stop listening for incoming connections.</p>
<p>Although QTcpServer is mostly designed for use with an event loop, it's possible to use it without one. In that case, you must use <a href="qtcpserver.html#waitForNewConnection">waitForNewConnection</a>(), which blocks until either a connection is available or a timeout expires.</p>
<a name="symbian-platform-security-requirements"></a>
<h3>Symbian Platform Security Requirements</h3>
<p>On Symbian, processes which use this class must have the <tt>NetworkServices</tt> platform security capability. If the client process lacks this capability, it will lead to a panic.</p>
<p>Platform security capabilities are added via the <a href="qmake-variable-reference.html#target-capability">TARGET.CAPABILITY</a> qmake variable.</p>
</div>
<p><b>See also </b><a href="qtcpsocket.html">QTcpSocket</a>, <a href="network-fortuneserver.html">Fortune Server Example</a>, <a href="network-threadedfortuneserver.html">Threaded Fortune Server Example</a>, <a href="network-loopback.html">Loopback Example</a>, and <a href="network-torrent.html">Torrent Example</a>.</p>
<!-- @@@QTcpServer -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTcpServer[overload1]$$$QTcpServerQObject* -->
<h3 class="fn"><a name="QTcpServer"></a>QTcpServer::<span class="name">QTcpServer</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qtcpserver.html">QTcpServer</a> object.</p>
<p><i>parent</i> is passed to the <a href="qobject.html">QObject</a> constructor.</p>
<p><b>See also </b><a href="qtcpserver.html#listen">listen</a>() and <a href="qtcpserver.html#setSocketDescriptor">setSocketDescriptor</a>().</p>
<!-- @@@QTcpServer -->
<!-- $$$~QTcpServer[overload1]$$$~QTcpServer -->
<h3 class="fn"><a name="dtor.QTcpServer"></a>QTcpServer::<span class="name">~QTcpServer</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the <a href="qtcpserver.html">QTcpServer</a> object. If the server is listening for connections, the socket is automatically closed.</p>
<p>Any client <a href="qtcpsocket.html">QTcpSocket</a>s that are still connected must either disconnect or be reparented before the server is deleted.</p>
<p><b>See also </b><a href="qtcpserver.html#close">close</a>().</p>
<!-- @@@~QTcpServer -->
<!-- $$$addPendingConnection[overload1]$$$addPendingConnectionQTcpSocket* -->
<h3 class="fn"><a name="addPendingConnection"></a><span class="type">void</span> QTcpServer::<span class="name">addPendingConnection</span> ( <span class="type"><a href="qtcpsocket.html">QTcpSocket</a></span> * <i>socket</i> )<tt> [protected]</tt></h3>
<p>This function is called by <a href="qtcpserver.html#incomingConnection">QTcpServer::incomingConnection</a>() to add the <i>socket</i> to the list of pending incoming connections.</p>
<p><b>Note:</b> Don't forget to call this member from reimplemented <a href="qtcpserver.html#incomingConnection">incomingConnection</a>() if you do not want to break the Pending Connections mechanism.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also </b><a href="qtcpserver.html#incomingConnection">incomingConnection</a>().</p>
<!-- @@@addPendingConnection -->
<!-- $$$close[overload1]$$$close -->
<h3 class="fn"><a name="close"></a><span class="type">void</span> QTcpServer::<span class="name">close</span> ()</h3>
<p>Closes the server. The server will no longer listen for incoming connections.</p>
<p><b>See also </b><a href="qtcpserver.html#listen">listen</a>().</p>
<!-- @@@close -->
<!-- $$$errorString[overload1]$$$errorString -->
<h3 class="fn"><a name="errorString"></a><span class="type"><a href="qstring.html">QString</a></span> QTcpServer::<span class="name">errorString</span> () const</h3>
<p>Returns a human readable description of the last error that occurred.</p>
<p><b>See also </b><a href="qtcpserver.html#serverError">serverError</a>().</p>
<!-- @@@errorString -->
<!-- $$$hasPendingConnections[overload1]$$$hasPendingConnections -->
<h3 class="fn"><a name="hasPendingConnections"></a><span class="type">bool</span> QTcpServer::<span class="name">hasPendingConnections</span> () const<tt> [virtual]</tt></h3>
<p>Returns true if the server has a pending connection; otherwise returns false.</p>
<p><b>See also </b><a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a>() and <a href="qtcpserver.html#setMaxPendingConnections">setMaxPendingConnections</a>().</p>
<!-- @@@hasPendingConnections -->
<!-- $$$incomingConnection[overload1]$$$incomingConnectionint -->
<h3 class="fn"><a name="incomingConnection"></a><span class="type">void</span> QTcpServer::<span class="name">incomingConnection</span> ( <span class="type">int</span> <i>socketDescriptor</i> )<tt> [virtual protected]</tt></h3>
<p>This virtual function is called by <a href="qtcpserver.html">QTcpServer</a> when a new connection is available. The <i>socketDescriptor</i> argument is the native socket descriptor for the accepted connection.</p>
<p>The base implementation creates a <a href="qtcpsocket.html">QTcpSocket</a>, sets the socket descriptor and then stores the <a href="qtcpsocket.html">QTcpSocket</a> in an internal list of pending connections. Finally <a href="qtcpserver.html#newConnection">newConnection</a>() is emitted.</p>
<p>Reimplement this function to alter the server's behavior when a connection is available.</p>
<p>If this server is using <a href="qnetworkproxy.html">QNetworkProxy</a> then the <i>socketDescriptor</i> may not be usable with native socket functions, and should only be used with <a href="qabstractsocket.html#setSocketDescriptor">QTcpSocket::setSocketDescriptor</a>().</p>
<p><b>Note:</b> If you want to handle an incoming connection as a new <a href="qtcpsocket.html">QTcpSocket</a> object in another thread you have to pass the socketDescriptor to the other thread and create the <a href="qtcpsocket.html">QTcpSocket</a> object there and use its <a href="qtcpserver.html#setSocketDescriptor">setSocketDescriptor</a>() method.</p>
<p><b>See also </b><a href="qtcpserver.html#newConnection">newConnection</a>(), <a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a>(), and <a href="qtcpserver.html#addPendingConnection">addPendingConnection</a>().</p>
<!-- @@@incomingConnection -->
<!-- $$$isListening[overload1]$$$isListening -->
<h3 class="fn"><a name="isListening"></a><span class="type">bool</span> QTcpServer::<span class="name">isListening</span> () const</h3>
<p>Returns true if the server is currently listening for incoming connections; otherwise returns false.</p>
<p><b>See also </b><a href="qtcpserver.html#listen">listen</a>().</p>
<!-- @@@isListening -->
<!-- $$$listen[overload1]$$$listenconstQHostAddress&quint16 -->
<h3 class="fn"><a name="listen"></a><span class="type">bool</span> QTcpServer::<span class="name">listen</span> ( const <span class="type"><a href="qhostaddress.html">QHostAddress</a></span> &amp; <i>address</i> = QHostAddress::Any, <span class="type"><a href="qtglobal.html#quint16-typedef">quint16</a></span> <i>port</i> = 0 )</h3>
<p>Tells the server to listen for incoming connections on address <i>address</i> and port <i>port</i>. If <i>port</i> is 0, a port is chosen automatically. If <i>address</i> is <a href="qhostaddress.html#SpecialAddress-enum">QHostAddress::Any</a>, the server will listen on all network interfaces.</p>
<p>Returns true on success; otherwise returns false.</p>
<p><b>See also </b><a href="qtcpserver.html#isListening">isListening</a>().</p>
<!-- @@@listen -->
<!-- $$$maxPendingConnections[overload1]$$$maxPendingConnections -->
<h3 class="fn"><a name="maxPendingConnections"></a><span class="type">int</span> QTcpServer::<span class="name">maxPendingConnections</span> () const</h3>
<p>Returns the maximum number of pending accepted connections. The default is 30.</p>
<p><b>See also </b><a href="qtcpserver.html#setMaxPendingConnections">setMaxPendingConnections</a>() and <a href="qtcpserver.html#hasPendingConnections">hasPendingConnections</a>().</p>
<!-- @@@maxPendingConnections -->
<!-- $$$newConnection[overload1]$$$newConnection -->
<h3 class="fn"><a name="newConnection"></a><span class="type">void</span> QTcpServer::<span class="name">newConnection</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted every time a new connection is available.</p>
<p><b>See also </b><a href="qtcpserver.html#hasPendingConnections">hasPendingConnections</a>() and <a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a>().</p>
<!-- @@@newConnection -->
<!-- $$$nextPendingConnection[overload1]$$$nextPendingConnection -->
<h3 class="fn"><a name="nextPendingConnection"></a><span class="type"><a href="qtcpsocket.html">QTcpSocket</a></span> * QTcpServer::<span class="name">nextPendingConnection</span> ()<tt> [virtual]</tt></h3>
<p>Returns the next pending connection as a connected <a href="qtcpsocket.html">QTcpSocket</a> object.</p>
<p>The socket is created as a child of the server, which means that it is automatically deleted when the <a href="qtcpserver.html">QTcpServer</a> object is destroyed. It is still a good idea to delete the object explicitly when you are done with it, to avoid wasting memory.</p>
<p>0 is returned if this function is called when there are no pending connections.</p>
<p><b>Note:</b> The returned <a href="qtcpsocket.html">QTcpSocket</a> object cannot be used from another thread. If you want to use an incoming connection from another thread, you need to override <a href="qtcpserver.html#incomingConnection">incomingConnection</a>().</p>
<p><b>See also </b><a href="qtcpserver.html#hasPendingConnections">hasPendingConnections</a>().</p>
<!-- @@@nextPendingConnection -->
<!-- $$$proxy[overload1]$$$proxy -->
<h3 class="fn"><a name="proxy"></a><span class="type"><a href="qnetworkproxy.html">QNetworkProxy</a></span> QTcpServer::<span class="name">proxy</span> () const</h3>
<p>Returns the network proxy for this socket. By default <a href="qnetworkproxy.html#ProxyType-enum">QNetworkProxy::DefaultProxy</a> is used.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qtcpserver.html#setProxy">setProxy</a>() and <a href="qnetworkproxy.html">QNetworkProxy</a>.</p>
<!-- @@@proxy -->
<!-- $$$serverAddress[overload1]$$$serverAddress -->
<h3 class="fn"><a name="serverAddress"></a><span class="type"><a href="qhostaddress.html">QHostAddress</a></span> QTcpServer::<span class="name">serverAddress</span> () const</h3>
<p>Returns the server's address if the server is listening for connections; otherwise returns <a href="qhostaddress.html#SpecialAddress-enum">QHostAddress::Null</a>.</p>
<p><b>See also </b><a href="qtcpserver.html#serverPort">serverPort</a>() and <a href="qtcpserver.html#listen">listen</a>().</p>
<!-- @@@serverAddress -->
<!-- $$$serverError[overload1]$$$serverError -->
<h3 class="fn"><a name="serverError"></a><span class="type"><a href="qabstractsocket.html#SocketError-enum">QAbstractSocket::SocketError</a></span> QTcpServer::<span class="name">serverError</span> () const</h3>
<p>Returns an error code for the last error that occurred.</p>
<p><b>See also </b><a href="qtcpserver.html#errorString">errorString</a>().</p>
<!-- @@@serverError -->
<!-- $$$serverPort[overload1]$$$serverPort -->
<h3 class="fn"><a name="serverPort"></a><span class="type"><a href="qtglobal.html#quint16-typedef">quint16</a></span> QTcpServer::<span class="name">serverPort</span> () const</h3>
<p>Returns the server's port if the server is listening for connections; otherwise returns 0.</p>
<p><b>See also </b><a href="qtcpserver.html#serverAddress">serverAddress</a>() and <a href="qtcpserver.html#listen">listen</a>().</p>
<!-- @@@serverPort -->
<!-- $$$setMaxPendingConnections[overload1]$$$setMaxPendingConnectionsint -->
<h3 class="fn"><a name="setMaxPendingConnections"></a><span class="type">void</span> QTcpServer::<span class="name">setMaxPendingConnections</span> ( <span class="type">int</span> <i>numConnections</i> )</h3>
<p>Sets the maximum number of pending accepted connections to <i>numConnections</i>. <a href="qtcpserver.html">QTcpServer</a> will accept no more than <i>numConnections</i> incoming connections before <a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a>() is called. By default, the limit is 30 pending connections.</p>
<p>Clients may still able to connect after the server has reached its maximum number of pending connections (i.e&#x2e;, <a href="qtcpsocket.html">QTcpSocket</a> can still emit the connected() signal). <a href="qtcpserver.html">QTcpServer</a> will stop accepting the new connections, but the operating system may still keep them in queue.</p>
<p><b>See also </b><a href="qtcpserver.html#maxPendingConnections">maxPendingConnections</a>() and <a href="qtcpserver.html#hasPendingConnections">hasPendingConnections</a>().</p>
<!-- @@@setMaxPendingConnections -->
<!-- $$$setProxy[overload1]$$$setProxyconstQNetworkProxy& -->
<h3 class="fn"><a name="setProxy"></a><span class="type">void</span> QTcpServer::<span class="name">setProxy</span> ( const <span class="type"><a href="qnetworkproxy.html">QNetworkProxy</a></span> &amp; <i>networkProxy</i> )</h3>
<p>Sets the explicit network proxy for this socket to <i>networkProxy</i>.</p>
<p>To disable the use of a proxy for this socket, use the <a href="qnetworkproxy.html#ProxyType-enum">QNetworkProxy::NoProxy</a> proxy type:</p>
<pre class="cpp"> server<span class="operator">-</span><span class="operator">&gt;</span>setProxy(<span class="type"><a href="qnetworkproxy.html">QNetworkProxy</a></span><span class="operator">::</span>NoProxy);</pre>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qtcpserver.html#proxy">proxy</a>() and <a href="qnetworkproxy.html">QNetworkProxy</a>.</p>
<!-- @@@setProxy -->
<!-- $$$setSocketDescriptor[overload1]$$$setSocketDescriptorint -->
<h3 class="fn"><a name="setSocketDescriptor"></a><span class="type">bool</span> QTcpServer::<span class="name">setSocketDescriptor</span> ( <span class="type">int</span> <i>socketDescriptor</i> )</h3>
<p>Sets the socket descriptor this server should use when listening for incoming connections to <i>socketDescriptor</i>. Returns true if the socket is set successfully; otherwise returns false.</p>
<p>The socket is assumed to be in listening state.</p>
<p><b>See also </b><a href="qtcpserver.html#socketDescriptor">socketDescriptor</a>() and <a href="qtcpserver.html#isListening">isListening</a>().</p>
<!-- @@@setSocketDescriptor -->
<!-- $$$socketDescriptor[overload1]$$$socketDescriptor -->
<h3 class="fn"><a name="socketDescriptor"></a><span class="type">int</span> QTcpServer::<span class="name">socketDescriptor</span> () const</h3>
<p>Returns the native socket descriptor the server uses to listen for incoming instructions, or -1 if the server is not listening.</p>
<p>If the server is using <a href="qnetworkproxy.html">QNetworkProxy</a>, the returned descriptor may not be usable with native socket functions.</p>
<p><b>See also </b><a href="qtcpserver.html#setSocketDescriptor">setSocketDescriptor</a>() and <a href="qtcpserver.html#isListening">isListening</a>().</p>
<!-- @@@socketDescriptor -->
<!-- $$$waitForNewConnection[overload1]$$$waitForNewConnectionintbool* -->
<h3 class="fn"><a name="waitForNewConnection"></a><span class="type">bool</span> QTcpServer::<span class="name">waitForNewConnection</span> ( <span class="type">int</span> <i>msec</i> = 0, <span class="type">bool</span> * <i>timedOut</i> = 0 )</h3>
<p>Waits for at most <i>msec</i> milliseconds or until an incoming connection is available. Returns true if a connection is available; otherwise returns false. If the operation timed out and <i>timedOut</i> is not 0, *<i>timedOut</i> will be set to true.</p>
<p>This is a blocking function call. Its use is disadvised in a single-threaded GUI application, since the whole application will stop responding until the function returns. waitForNewConnection() is mostly useful when there is no event loop available.</p>
<p>The non-blocking alternative is to connect to the <a href="qtcpserver.html#newConnection">newConnection</a>() signal.</p>
<p>If msec is -1, this function will not time out.</p>
<p><b>See also </b><a href="qtcpserver.html#hasPendingConnections">hasPendingConnections</a>() and <a href="qtcpserver.html#nextPendingConnection">nextPendingConnection</a>().</p>
<!-- @@@waitForNewConnection -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>