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


New member
Jul 4, 2009
Programming Experience
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

Private Sub ConnectUser(ByVal userName As String, ByVal sender As UserConnection)
        If clients.Contains(userName) Then
            ReplyToSender("REFUSE", sender)
            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

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


Any Help Would Be Greatly Appreciated
Top Bottom