void server::incomingConnection(qintptr socketDescriptor) {
qDebug() << "incoming connection";
connection* new_connection = new connection(this);
new_connection->set_socket_descriptor(socketDescriptor);
connect(new_connection, SIGNAL(ready_read()), this, SLOT(ready_read()));
connect(new_connection, SIGNAL(disconnected()), this, SLOT(disconnected()));
emit signal_new_connection(new_connection);
}
サーバー クラスは QTcpServer から継承され、接続クラスにはメンバーとして QTcpSocket があり、接続するユーザーに関する情報 (名前、IP、ID...) があります。
私の問題は、new_connection について何も知らないことです。誰がサーバーに接続しているかを知る必要があります。このため、接続したいのですが、どうすればよいですか? 何か方法はありますか?または、接続されたソケット(ユーザー)からデータ(グリーティングメッセージ)を受信するまで待つ必要がありますか?