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.

Recommended Answers

All 2 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.