private void AutostartListening() { if (Settings.AutoListen) { StartConnectionListener(); } if (Settings.EnableNoIPUpdater) { NoIpUpdater.Start(); } }
private void btnListen_Click(object sender, EventArgs e) { ushort port = GetPortSafe(); if (port == 0) { MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (btnListen.Text == "Start listening" && !_listenServer.Listening) { try { if (chkNoIPIntegration.Checked) { NoIpUpdater.Start(); } _listenServer.Listen(port, chkIPv6Support.Checked, chkUseUpnp.Checked); ToggleListenerSettings(false); } catch (SocketException ex) { if (ex.ErrorCode == 10048) { MessageBox.Show(this, "The port is already in use.", "Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(this, $"An unexpected socket error occurred: {ex.Message}\n\nError Code: {ex.ErrorCode}\n\n", "Unexpected Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } _listenServer.Disconnect(); } catch (Exception) { _listenServer.Disconnect(); } } else if (btnListen.Text == "Stop listening" && _listenServer.Listening) { _listenServer.Disconnect(); ToggleListenerSettings(true); } }
private void FrmMain_Load(object sender, EventArgs e) { InitializeServer(); if (XMLSettings.AutoListen) { if (XMLSettings.UseUPnP) { UPnP.ForwardPort(ushort.Parse(XMLSettings.ListenPort.ToString())); } ConServer.Listen(XMLSettings.ListenPort); } if (XMLSettings.IntegrateNoIP) { NoIpUpdater.Start(); } }
private void btnListen_Click(object sender, EventArgs e) { if (btnListen.Text == "Start listening" && !_listenServer.Listening) { try { if (chkUseUpnp.Checked && !Core.Helper.UPnP.IsPortForwarded) { Core.Helper.UPnP.ForwardPort(ushort.Parse(ncPort.Value.ToString(CultureInfo.InvariantCulture))); } if (chkNoIPIntegration.Checked) { NoIpUpdater.Start(); } _listenServer.Listen(ushort.Parse(ncPort.Value.ToString(CultureInfo.InvariantCulture))); } finally { btnListen.Text = "Stop listening"; ncPort.Enabled = false; txtPassword.Enabled = false; } } else if (btnListen.Text == "Stop listening" && _listenServer.Listening) { try { _listenServer.Disconnect(); if (Core.Helper.UPnP.IsPortForwarded) { Core.Helper.UPnP.RemovePort(); } } finally { btnListen.Text = "Start listening"; ncPort.Enabled = true; txtPassword.Enabled = true; } } }
private void AutostartListeningP() { if (XMLSettings.AutoListen && XMLSettings.UseUPnP) { UPnP.Initialize(XMLSettings.ListenPort); ConServer.Listen(XMLSettings.ListenPort); } else if (XMLSettings.AutoListen) { UPnP.Initialize(); ConServer.Listen(XMLSettings.ListenPort); } else { UPnP.Initialize(); } if (XMLSettings.IntegrateNoIP) { NoIpUpdater.Start(); } }
private void AutostartListening() { if (Settings.AutoListen && Settings.UseUPnP) { UPnP.Initialize(Settings.ListenPort); ListenServer.Listen(Settings.ListenPort, Settings.IPv6Support); } else if (Settings.AutoListen) { UPnP.Initialize(); ListenServer.Listen(Settings.ListenPort, Settings.IPv6Support); } else { UPnP.Initialize(); } if (Settings.EnableNoIPUpdater) { NoIpUpdater.Start(); } }
private void AutostartListening() { if (Settings.AutoListen && Settings.UseUPnP) { UPnP.Initialize(Settings.ListenPort); StartConnectionListener(); } else if (Settings.AutoListen) { UPnP.Initialize(); StartConnectionListener(); } else { UPnP.Initialize(); } if (Settings.EnableNoIPUpdater) { NoIpUpdater.Start(); } }
private void AutostartListening() { if (Ayarlar.AutoListen && Ayarlar.UseUPnP) { UPnP.Initialize(Ayarlar.ListenPort); ListenServer.Listen(Ayarlar.ListenPort); } else if (Ayarlar.AutoListen) { UPnP.Initialize(); ListenServer.Listen(Ayarlar.ListenPort); } else { UPnP.Initialize(); } if (Ayarlar.EnableNoIPUpdater) { NoIpUpdater.Start(); } }
private void btnListen_Click(object sender, EventArgs e) { ushort port = GetPortSafe(); string password = txtPassword.Text; if (port == 0) { MessageBox.Show("Lütfen 0'dan büyük geçerli bir port giriniz..", "Lütfen geçerli bir port giriniz.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (password.Length < 3) { MessageBox.Show("Lütfen en az 3 karakterden oluşan geçerli ve güvenilir bir şifre kullanınız.", "Güvenli bir şifre giriniz.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (btnListen.Text == "Dinlemeye Başla" && !_listenServer.Listening) { try { AES.SetDefaultKey(password); if (chkUseUpnp.Checked) { if (!UPnP.IsDeviceFound) { MessageBox.Show("Kullanılabilir hiçbir UPnP Cihazı Tespit Edilemedi!", "UPnP Cihazı Tespit Edilemedi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { int outPort; UPnP.CreatePortMap(port, out outPort); if (port != outPort) { MessageBox.Show("UPnP Cihazıyla Bir Port Map Oluşturma Başarısız.!\nLütfen cihazınızın UPnP Port Map desteği olup olmadığına bakınız.", "Port map oluşturumu başarısız", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } if (chkNoIPIntegration.Checked) { NoIpUpdater.Start(); } _listenServer.Listen(port); } finally { btnListen.Text = "Dinlemeyi Durdur"; ncPort.Enabled = false; txtPassword.Enabled = false; } } else if (btnListen.Text == "Dinlemeyi Durdur" && _listenServer.Listening) { try { _listenServer.Disconnect(); UPnP.DeletePortMap(port); } finally { btnListen.Text = "Dinlemeye Başla"; ncPort.Enabled = true; txtPassword.Enabled = true; } } }
private void btnListen_Click(object sender, EventArgs e) { ushort port = GetPortSafe(); string password = txtPassword.Text; if (port == 0) { MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (password.Length < 3) { MessageBox.Show("Please enter a secure password with more than 3 characters.", "Please enter a secure password", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (btnListen.Text == "Start listening" && !_listenServer.Listening) { try { AES.PreHashKey(password); if (chkUseUpnp.Checked) { if (!UPnP.IsDeviceFound) { MessageBox.Show("No available UPnP device found!", "No UPnP device", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { int outPort; UPnP.CreatePortMap(port, out outPort); if (port != outPort) { MessageBox.Show("Creating a port map with the UPnP device failed!\nPlease check if your device allows to create new port maps.", "Creating port map failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } if (chkNoIPIntegration.Checked) { NoIpUpdater.Start(); } _listenServer.Listen(port); } finally { btnListen.Text = "Stop listening"; ncPort.Enabled = false; txtPassword.Enabled = false; } } else if (btnListen.Text == "Stop listening" && _listenServer.Listening) { try { _listenServer.Disconnect(); UPnP.DeletePortMap(port); } finally { btnListen.Text = "Start listening"; ncPort.Enabled = true; txtPassword.Enabled = true; } } }
private void btnListen_Click(object sender, EventArgs e) { ushort port = GetPortSafe(); if (port == 0) { MessageBox.Show("Please enter a valid port > 0.", "Please enter a valid port", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (btnListen.Text == "Start listening" && !_listenServer.Listening) { try { if (chkUseUpnp.Checked) { if (!UPnP.IsDeviceFound) { MessageBox.Show(this, "No available UPnP device found!", "No UPnP device", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { int outPort; UPnP.CreatePortMap(port, out outPort); if (port != outPort) { MessageBox.Show(this, "Creating a port map with the UPnP device failed!\nPlease check if your device allows to create new port maps.", "Creating port map failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } if (chkNoIPIntegration.Checked) { NoIpUpdater.Start(); } _listenServer.Listen(port, chkIPv6Support.Checked); } catch (SocketException ex) { if (ex.ErrorCode == 10048) { MessageBox.Show(this, "The port is already in use.", "Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(this, $"An unexpected socket error occurred: {ex.Message}\n\nError Code: {ex.ErrorCode}\n\n", "Unexpected Socket Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } _listenServer.Disconnect(); } catch (Exception) { _listenServer.Disconnect(); } finally { btnListen.Text = "Stop listening"; ncPort.Enabled = false; chkIPv6Support.Enabled = false; } } else if (btnListen.Text == "Stop listening" && _listenServer.Listening) { try { _listenServer.Disconnect(); UPnP.DeletePortMap(port); } finally { btnListen.Text = "Start listening"; ncPort.Enabled = true; chkIPv6Support.Enabled = true; } } }