My application has many tcpclients that is uses to update hundreds of servers when instructed. I'm having trouble in the design with a minor but important issue.
My programs takes an outgoing message out of a queue and selects an available client from an array of clients, I'll call this client1. It starts a connection on the tcpclient with a BeginConnect and issues a call back method. The program then moves on to other messages from the queue and the tcpclients that will be sending them.
When the the callback happens for client1, my program gets an AsyncResult from which I can resolve the socket.
Here is my problem. How do I know which socket or TCPClient I have? It's important because I need to know which message to send on this connected client.
I've looked on the socket and didn't find a name property.
How do I identify the socket so I know the correct messaging conversation to have?
Thanks!