title: SocketDescriptor of QTcpSocket is -1
body: <p>I am designing server/clients system for my own. I create a class with extending from <code>QTcpServer</code> and define <code>QMap &lt;ClientName, int&gt; sockets</code> to handle connected clients. Clients can  connect to server when <code>sockets</code> map doesn't contains socket with same <code>ClientName</code> as new client. So, when new socket connects to server, I store client <code>Pair &lt;ClientName, SocketDescriptor&gt;</code> in qmap. With these explanation, I should remove client descriptor from qmap when client <code>disconnects</code> from server. So, I create slot <code>void disconnected()</code> and implement it as follow:</p>
  
  <pre><code>void MyServer::disconnected()
  {
     QTcpSocket* socket = (QTcpSocket*) sender();
     ClientType socketType = ClientTypeNone;
     foreach(ClientType key, _sockets.keys())
     {
        if (sockets.value(key) == socket.socketDescriptor())
        {
           socketType = key;
           break;
        }
     }
  
     if (socketType != ClientTypeNone)
     {
        sockets.remove(socketType);
     }
  }
  </code></pre>
  
  <p>But, <code>socket.socketDescriptor</code> is -1, while I've set it in below code:</p>
  
  <pre><code>void MyServer::inComingConnection(qintptr socketDescriptor)
  {
     QTcpSocket* socket = nextPendingConnection();
     connect(s, SIGNAL(readyRead()), this, SLOT(readyRead());
     connect(s, SIGNAL(disconnected()), this, SLOT(disconnected());
     socket-&gt;setSocketDescriptor(socketDescriptor);
  }
  </code></pre>
  
  <p>What was it wrong ?</p>