using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using SocketIOSharp.Common; using SocketIOSharp.Server; using SocketIOSharp.Client; using SocketIOSharp.Server.Client; using EngineIOSharp.Common.Enum; using Json.Net; namespace PolyChat.Models { class ClientHandler { public List clients = new List(); public ClientHandler() { } /// /// connects new clients and saves them in list /// /// ip adress of parter public void connectNewClient(String clientCode) { //Todo: convert code into ip SocketIOClient connection = new SocketIOClient(new SocketIOClientOption(EngineIOScheme.http, clientCode, 8050)); connection.Connect(); clients.Add(new Client(connection, clientCode)); } /// /// returns client that fits to ip adress /// /// /// public Client getClient(String ip) { foreach (Client cl in clients) { if (cl.getIP().Equals(ip)) { return cl; } } return null; } } }