static void Main(string[] args) { DiffContainer.Init(100); var host = new WebSocketHost(typeof(Connection), new ServiceThrottlingBehavior() { MaxConcurrentSessions = int.MaxValue, MaxConcurrentCalls = int.MaxValue, MaxConcurrentInstances = int.MaxValue }, new Uri("ws://localhost:9080/PolyJoin")); var binding = WebSocketHost.CreateWebSocketBinding(https: false, sendBufferSize: int.MaxValue, receiveBufferSize: int.MaxValue); binding.SendTimeout = TimeSpan.FromMilliseconds(5000); binding.OpenTimeout = TimeSpan.FromDays(1); host.AddWebSocketEndpoint(binding); Console.WriteLine("Open host"); host.Open(); host.Faulted += (sender, eventArgs) => { Console.WriteLine("Host falted"); }; CommonService.Init(); Console.ReadLine(); Console.WriteLine("Close host"); host.Close(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DiffContainer.Init(byte.Parse(ConfigurationSettings.AppSettings["quality"])); _connectionManager = new ConnectionManager { ServerIp = "localhost" }; _connectForm = new ConnectForm { ServerIp = _connectionManager.ServerIp }; _mainForm = new MainForm { ScreenshotScale = float.Parse(ConfigurationSettings.AppSettings["scale"]), ScreenshotTimeout = int.Parse(ConfigurationSettings.AppSettings["timeout"]), JpegQuality = byte.Parse(ConfigurationSettings.AppSettings["quality"]) }; _connectForm.VisibleChanged += (sender, eventArgs) => { if (!_connectForm.Visible) { _connectionManager.ServerIp = _connectForm.ServerIp; var clientWebSocketConnection = new ClientWebSocketConnection(_connectionManager.GetConnection()); _mainForm.ClientWebSocketConnection = clientWebSocketConnection; _mainForm.ConferenceId = _connectForm.ConferenceId; _mainForm.ClientName = _connectForm.ClientName; _connectionManager.Connect(); _mainForm.Show(); } else { _connectionManager.Disconnect(); } }; _mainForm.VisibleChanged += (sender, eventArgs) => { if (!_mainForm.Visible) { _connectForm.Show(); } }; Application.Run(_connectForm); }