PDA

View Full Version : QTcpServer::incomingConnection ( int socketDescriptor )



insert
8th September 2010, 14:53
I can't understand this function ,especially socketDescriptor. what I can do.

^NyAw^
8th September 2010, 15:01
Hi,

Create a Socket passing this value to it. Think on that is an identifier.

daemonna
8th September 2010, 15:02
this function is spawned when client connects to server, thus 'incoming Connection'... socket descriptor is just indetificator of socket, nothing else (because you can have more-than-one clients connected)...

insert
8th September 2010, 15:24
thank you for you reply. now,I meet a question,I want server to receive message from many clients. using the thread.
this QTcpServer::incomingConnection can help me do this work?

^NyAw^
8th September 2010, 15:35
Hi,

You can create on thread every time "incomingConnection" is called.
But the question is, do you really need threads?

insert
8th September 2010, 16:10
have you other methor ?

tbscope
8th September 2010, 16:17
have you other methor ?
Yes, do not use any blocking functions.

insert
8th September 2010, 16:21
it maybe troublesome. ok,I will do it in my methor. thank you!

insert
11th September 2010, 10:41
at last ,I I finally got the question!