Edenost
Edenost

Reputation: 21

Checking for a specific open TCP Port with C++ on Windows OS

I have a patching program for a game and before the button to open the game is able to be clicked I am wanting it to check that the server is actually online which has a static ip address and port that is used and never changes. Right now it checks if there are any patches before the play button is activated but I want it to also check if the server is online.

I've already been searching but perhaps I've not been using the right terminology.

Basically I don't need it to show any messages just check if the specific port is listening.

Upvotes: 0

Views: 555

Answers (1)

MSalters
MSalters

Reputation: 180265

Have you just tried connecting?

TCP uses a three-way handshake: SYN, SYN-ACK, ACK. You don't need to know the exact details, your OS will handle it if you connect. And if the other side does not have its port open, it won't reply with that SYN-ACK. Your OS will time out and inform you that the other side ignored you.

Upvotes: 3

Related Questions