public bool StartConnection(NetConnectionSettings WithConfig)
        {
            //jeśli jesteśmy już połączeni, nie łączymy się jeszcze raz
            if (ConnectionOpened)
            {
                throw new Exception("already_connected");
            }

            try
            {
                NetSocket = new TcpClient(WithConfig.Hostname, WithConfig.Port);
                if (WithConfig.UseSsl)
                {
                    SslStream Ssl = new SslStream(NetSocket.GetStream());
                    Ssl.AuthenticateAsClient(WithConfig.Hostname);
                    NetStream = Ssl;
                }
                else
                {
                    NetStream = NetStream = NetSocket.GetStream();
                }
            }
            catch (Exception e)
            {
                throw new Exception("connection_init_error: " + e.ToString());
            }

            return(true);
        }
Пример #2
0
 public void CloneFrom(NetConnectionSettings In)
 {
     Hostname     = In.Hostname;
     Port         = In.Port;
     UserLogin    = In.UserLogin;
     UserPassword = In.UserPassword;
     UseSsl       = In.UseSsl;
     CloneChildData(In);
 }
 public override void CloneChildData(NetConnectionSettings InSettings)
 {
 }
 public override void CloneChildData(NetConnectionSettings InSettings)
 {
     RefreshRateSeconds = ((PopConnectionSettings)InSettings).RefreshRateSeconds;
 }
Пример #5
0
 public abstract void CloneChildData(NetConnectionSettings InSettings);