diff --git a/llcom/Pages/TcpLocalPage.xaml.cs b/llcom/Pages/TcpLocalPage.xaml.cs index 748bf94..c9cb6c6 100644 --- a/llcom/Pages/TcpLocalPage.xaml.cs +++ b/llcom/Pages/TcpLocalPage.xaml.cs @@ -187,8 +187,17 @@ private bool StartServer(string ip, int port) if (Server != null) return false; IPAddress localAddr = IPAddress.Parse(ip); - Server = new TcpListener(localAddr, port); - Server.Start(); + try + { + Server = new TcpListener(localAddr, port); + Server.Start(); + } + catch (Exception ex) + { + Server = null; + throw ex; + } + var isV6 = ip.Contains(":"); ShowData($"🛰 {(isV6 ? "[" : "")}{ip}{(isV6 ? "]" : "")}:{port}"); AsyncCallback newConnectionCb = null;