Пример #1
0
 public FPEncryptor(FPPackage pkg)
 {
     if (pkg != null)
     {
         this._pkg = pkg;
     }
     else
     {
         this._pkg = new FPPackage();
     }
 }
Пример #2
0
        protected void Init(string host, int port, int connectionTimeout)
        {
            this._pkg      = new FPPackage();
            this._cry      = new FPEncryptor(_pkg);
            this._psr      = new FPProcessor();
            this._callback = new FPCallback();

            if (connectionTimeout <= 0)
            {
                connectionTimeout = 30 * 1000;
            }

            FPManager.Instance.AddSecond(OnSecondDelegate);
            this._sock = new FPSocket(OnData, host, port, connectionTimeout);
            this._sock.Socket_Connect = this.OnConnect;
            this._sock.Socket_Close   = this.OnClose;
            this._sock.Socket_Error   = this.OnError;
        }
Пример #3
0
        protected void Init(string host, int port, bool autoReconnect, int connectionTimeout)
        {
            this._pkg      = new FPPackage();
            this._cyr      = new FPEncryptor(_pkg);
            this._event    = new FPEvent();
            this._psr      = new FPProcessor();
            this._callback = new FPCallback();

            if (connectionTimeout > 0)
            {
                this._timeout = connectionTimeout;
            }

            this._autoReconnect = autoReconnect;

            FPClient self = this;

            this._eventDelegate = (evd) => {
                self.OnSecond(evd.GetTimestamp());
            };

            ThreadPool.Instance.Event.AddListener("second", this._eventDelegate);

            this._sock = new FPSocket((stream) => {
                self.OnData(stream);
            }, host, port, this._timeout);

            this._sock.GetEvent().AddListener("connect", (evd) => {
                self.OnConnect();
            });

            this._sock.GetEvent().AddListener("close", (evd) => {
                self.OnClose();
            });

            this._sock.GetEvent().AddListener("error", (evd) => {
                self.OnError(evd.GetException());
            });
        }
Пример #4
0
 public FPEncryptor(FPPackage pkg)
 {
     this._pkg = pkg;
 }