General discussion


Server-side solution for web conference

By DevNiko68 ·
The server-side solution of the web conference example is a C# console application. It uses the background support of Ozeki VoIP SIP SDK by being derived from the Ozeki MediaGateway class. This means that the server overrides some basic methods and defines a few others for the client-client communication and it can run properly.
The code shows the method that runs when the server starts. It is an overridden method from the MediaGateway class and basically just initializes the client list as a Dictionary.
1. public override void OnStart()
2. {
3. chatClients = new Dictionary<string, IClient>();
4. Console.WriteLine("Web2Web Gateway started.");
5. }
In next code you can see the method that is invoked when a client connects to the server. It is also an overridden method that puts the newly connected client in the client list and writes some log information on the console.
1. public override void OnClientConnect(IClient client, object[] parameters)
2. {
3. Console.WriteLine( "{0} client connected to the server.",client.RemoteAddress);
4. if (!chatClients.ContainsKey(string.Format("client{0}", clientCounter++)))
5. {
6. chatClients.Add(string.Format("client{0}", clientCounter++), client);
7. }
8. }
When a client is disconnected from the server, the method shown in the following code is invoked. This method only contains basic debug information as the client list is handled in another one.
1. public override void OnClientDisconnect(IClient client)
4. if (chatClients.ContainsValue(client))
5. {
6. Console.WriteLine("{0} client disconnected from the server.", client.RemoteAddress);
7. return;
8. }
If you need more infor then you can visit this page:


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums