VB.NET - TcpClient AcceptTcpClientAsync how to tell if unique?

Asked By Graeme Townsend on 25-Jul-18 08:25 PM

I have a simple Client/Server system running that works well.

I can tell if an incoming connection is from the same IP address as an existing connection, however, I cannot tell if it is the same app or not? (eg if someone starts another version of the app on that machine).

(There can be a scenario where two different apps from the same machine connect to the server application, I want to be able to determine which has connected).

Is there a way I can load info into the outgoing client TcpClient variable for evaluation at the server end? Or another method? GUID perhaps?

Thanks.

Robbe Morris replied to Graeme Townsend on 25-Jul-18 09:31 PM
No, not without modifying your application.  What is typically done in this scenario is that the server accepts an incoming authentication request over the socket, the server replies back with a unique token, and the client app resends that token each time.  The server keeps a cache of live tokens it has released to clients.

That doesn't tell you specifically which application is accessing your service but at least you would know which instance to kill should it be necessary.
Graeme Townsend replied to Robbe Morris on 25-Jul-18 10:02 PM
Thanks. Makes sense. Time to do some coding......