private void StartServer() { var dlg = new EndPointDialog(); var endPoint = dlg.ShowEndPoint("link://3333"); if (endPoint != null) { var listener = CoreHelper.CreateListenerForEndPoint(endPoint); var server = new HttpServer(listener, new[] { "rho.me" }, Program.Instance.HandlerFactory); var form = new HttpServerForm(server); form.Show(); } }
private void MainForm_Load(object sender, EventArgs e) { try { var streamListener = new LinkStreamListener(3333); var server = new HttpServer(streamListener, new[] { "rho.me", }, Program.Instance.HandlerFactory); var serverForm = new HttpServerForm(server); serverForm.Show(); serverForm.ClickStartButton(); Helper.DoLater(() => { var stream = CoreHelper.CreateStreamFromEndPoint("link://3333"); var client = new HttpClient(stream); var clientForm = new ClientForm(client); clientForm.Show(); }, 100); } catch (Exception ex) { MessageBox.Show(ex.Message); } }