private async Task StartAndConnectSocket()
 {
     if (!IsListener)
     {
         if (SocketClient == null)
         {
             SocketClient = SocketClient.CreateNew(RemoteSocketListenerSvrName, Port, BindToAny, Passkey);
         }
         if (SocketClient != null)
         {
             await(SocketClient.ConnectSocket());
         }
     }
     else
     {
         if (SocketListenerSvr == null)
         {
             SocketListenerSvr = SocketListenerSvr.CreateNew(RemoteSocketListenerSvrName, Port, BindToAny, Passkey);
             SocketListenerSvr.ListenerConnection += SocketListenerSvr_ListenerConnection;
         }
         if (SocketListenerSvr != null)
         {
             SocketListenerSvr.StartListener();
         }
     }
 }
 private void Start_LocalListenerSvr(object sender, RoutedEventArgs e)
 {
     if (SocketListenerSvr == null)
     {
         SocketListenerSvr = SocketListenerSvr.CreateNew(RemoteSocketListenerSvrName, Port, BindToAny, Passkey);
     }
     if (SocketListenerSvr != null)
     {
         SocketListenerSvr.StartListener();
     }
 }
 private void DisconnectFromListener()
 {
     try
     {
         SocketClose.CloseSockets();
         SocketSend_ClientToLister = null;
         SocketClient      = null;
         SocketListenerSvr = null;
     }
     catch (Exception ex)
     {
         SocketClientServer.Sox.Instance.Log(ex.Message);
     }
 }