BrandonPotter / SimpleTCP

Straightforward .NET library to handle the repetitive tasks of spinning up and working with TCP sockets (client and server).
Apache License 2.0
363 stars 108 forks source link

Getting all connected clients #46

Open Alanjdv opened 6 years ago

Alanjdv commented 6 years ago

I decided to use SimpleTcp for a little game I'm developing, and it works prety well. However, I cannot get all connected clients to my server (reviewing the code it seems they are stored in a private list), so... Am I missing anything? Or is there a reason to make them non accessable? Excuse my english and thanks for your work.

harleyknd1 commented 6 years ago

The easiest solution would be having a list on your server end that keeps track of that, rather than relying on the tcp listener to reliably keep track of clients.

A tcp client can disconnect after the data has been send. As well as allowing you to secure it using a form of encryption to prevent users from tampering with the data being send.

In my own implementation I loop over a list of clients on the server end on a timer and ping them back to see if they're still alive and remove them if they're not