I am using WCF with netTcpBinding duplex and I want to send a message to all users currently connected to my service. I thought I could just create a callback contract, and it will send a message to all clients, but it seems like I'm wrong, and there is not a single server / service, each client gets its own service?
I have a service called "Server". This is how I access the server from the client -
ServerClient client = new ServerClient(); string result = client.SendMessage(messageTextBox.Text); client.Close();
I thought that the βServerβ was the only object that handled all the calls of my clients, but then I started the thread in the Server constructor and I found out that several threads are starting, because every time the client calls the Server, a new server object is created .
So, each client has its own service / server.
- With this in mind, how to send a message to all my clients from the server?
- I thought the standard practice of accessing the server from the client was to get a proxy object, call utility functions and then close the proxy object, as in the code above ... but if I close the proxy object, This means that I closed the connection between the client and the server, and now the server will not be able to make two-way callbacks to the client?
source share