I am creating a basic threaded server and chat client... so far everything is going to plan however i am confused as to how i will make two clients(which ever they maybe) connect and send their data to each other.
My idea is in the server app i will make two arrays, one will hold all the seperate client socket connections and the other will hold that clients id, which for now is counter.
so my train of thought goes, each connection the server gets it will save the socket and id of that connection into 2 arrays, each message the server gets it will locate maybe a string "talk" and right after that will be the client id and message i.e "talk1hello", so my server would break up the string and get the id of the client that the other wishes to speak to, i will then search the client id array (on server) for a matching number and once it finds a match i will set the current outgoing socket to the value at which the client id matched that of the client id stored in the server client id array . i am using a flat array which is much like the 2d array however its split into to one dimensional arrays.
so now i can then use my new found data to send the message to the other client, is this a good way or is their maybe a native method in c# for this?
Edited by DavidKroukamp: n/a