I am using C# language to allow clients that are designed in WPF platform to send string via server to another clients.
But problem with my code is that I am broadcasting from my server to all clients same message while using TCP protocol. I know that TCP is famous with the fact that you can specify endpoint.But I don't know how.
This is what I do in server.
foreach (Socket _connectedUsers in clientSockets)
{
byte[] data = Encoding.UTF32.GetBytes(Message);
Socket socket = (Socket)_connectedUsers;
socket.Send(data);
}
What this code does is broadcasting message to everyone from a list in clientSockets.
Now the question.
How can I do something like:
byte[] data = Encoding.UTF32.GetBytes(Message);
Socket socket = (Endpoint User IP Address);
socket.Send(data);