Beispiel #1
0
        //Call this to create a new instance of this listener class, rather than the constructor
        public static SocketListenerSvr CreateNew(string remoteSocketListenerSvrName, string port, bool bindtoany, string passkey)
        {
            SocketListenerSvr _SocketListenerSvr = null;

            if (Sox.AppMode == AppMode.None)
            {
                if (Sox.IsNumeric_uint(port))
                {
                    _SocketListenerSvr = new SocketListenerSvr(remoteSocketListenerSvrName, port, bindtoany, passkey);
                    if (_SocketListenerSvr != null)
                    {
                        Sox.AppMode = AppMode.NewListner;
                    }
                }
                else
                {
                    Sox.Instance.Log(
                        "Invalid Port string for listener service.",
                        NotifyType.ErrorMessage);
                }
            }
            else
            {
                Sox.Instance.Log(
                    "Unable to create SocketListner. Incorrect AppMode.",
                    NotifyType.ErrorMessage);
            }

            return(_SocketListenerSvr);
        }
 public SocketClient(string remoteSocketListenerSvrName, string port, bool bindtoany)
 {
     if (Sox.IsNumeric_uint(port))
     {
         RemoteSocketListenerSvrName  = remoteSocketListenerSvrName;
         PortOrServicenameForListener = port;
     }
     else
     {
         Sox.Instance.Log(
             "Invalid Port string for client.",
             NotifyType.ErrorMessage);
     }
 }
Beispiel #3
0
 //We only use this constructor:
 public SocketListenerSvr(string remoteSocketListenerSvrName, string port, bool bindtoany, string passkey)
 {
     Passkey = passkey;
     if (Sox.IsNumeric_uint(port))
     {
         BindToAny_IsChecked          = bindtoany;
         RemoteSocketListenerSvrName  = remoteSocketListenerSvrName;
         PortOrServicenameForListener = port;
         //Hook up a local ListenerConnection Event handler
         this.ListenerConnection += SocketListenerSvr_ListenerConnection;
     }
     else
     {
         Sox.Instance.Log(
             "Invalid Port string for listener service.",
             NotifyType.ErrorMessage);
     }
 }