Mourad Karim
Mourad Karim

Reputation: 171

How can I reject TCP request with Qt

In Qt5 if we use qtcpSocket->->disconnectFromHost(); that mean i close competely the connection to the distant Host. My question is how can i reject a tcp connection ???

Thx all

Upvotes: 2

Views: 757

Answers (2)

kikeenrique
kikeenrique

Reputation: 2669

It's a TCP protocol design question. Once a connection is opened, you can't reject it. You just can closed, if

Detailed explanation in this answer: https://stackoverflow.com/a/1117132/721929

Upvotes: 1

wnrph
wnrph

Reputation: 3393

You can't. After the passive open(), the OS accepts every connection while your program sleeps.

Upvotes: 4

Related Questions