954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

WinSock - getting those connected to you through a game

Hi, I was wondering if anyone could help me figure out how to see who is connected to you when you are hosting a game on a specific port via c++. I know you can use netstat in cmd prompt and it shows a bunch of info of who you are connected to and stuff.

What I want to do is make a program with C++/win32 api and winsock that detects people connecting to me and I would like to be able to ping to that IP or disconnect them.

Thanks for those that take the time to read this.

sfuo
Practically a Master Poster
656 posts since Jul 2009
Reputation Points: 164
Solved Threads: 99
 

For first you have to create socket. After that wait for connections. When connection is incoming, accept it and get data of connection(IP, port...) from the second argument of function accept. After that - type some function, which will send some test packets and awaits for the answer (some kind of ping), or use ShellExecute for using standard ping.

Something like that.

Protuberance
Junior Poster in Training
90 posts since Aug 2009
Reputation Points: 78
Solved Threads: 17
 

listen all I can connect and send messages at local but I can't connect in global. why? what should I do?

lashatt2
Light Poster
36 posts since Oct 2009
Reputation Points: 5
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: