Question TCP Server/Client "Individual Send To Conected client"

casirus

New member
Joined
Jul 4, 2009
Messages
1
Programming Experience
Beginner
Hello Well My Issue Is this i have spent the past 2 weeks working On A Chat Program for a client of mine and i seem to of hit a dead end.

I have got the server app an the Client app Both Working to what i can see But My issue is i was only asked 4 days ago if i could add a Private msg and Whisper Feature as well as admin controls I have Done what i could to it then realised i have no idea how to only send the data to the selected client.

So heres my Question How Would I send Data Not To all conected Clients But Only to the selected Client that the user has selected For the User name ListBox???


here is the code below that adds the user to the servers memory

Code:
Private Sub ConnectUser(ByVal userName As String, ByVal sender As UserConnection)
        If clients.Contains(userName) Then
            ReplyToSender("REFUSE", sender)
        Else
            sender.Name = userName
            UpdateStatus(userName & " has joined the chat.")
            clients.Add(userName, sender)
 
            ' Send a JOIN to sender, and notify all other clients that sender joined
            ReplyToSender("JOIN", sender)
            SendToClients("CHAT|" & sender.Name & " has joined the chat.", sender)
        End If
    End Sub
And also as far as im aware it stores the client at a hash table I say im aware that's because it was my partner who done this part of code but he is in hospital

Code:
Private clients As New Hashtable()
Im not sure how to select the user from the hash table and then send the needed string to the selected user once the admin on the server clicks the corresponding on the context menu

Any Help Would Be Greatly Appreciated :eek:

Thanks In Advance

D.L.H.

Any Help Would Be Greatly Appreciated
 
Top Bottom