Beispiel #1
0
            public CClient(
                TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_, net.TLinkFunc LinkFuncSoft_, TUnLinkFunc UnLinkSoftFunc_,
                TCheckFunc CheckFunc_, TCheckFailFunc CheckFailFunc_, SVersion Version_)
            {
                _Version = Version_;

                _NetA = new net.CClient(
                    _LinkA, _LinkFailA, _UnLinkA, _RecvA,
                    false, 1024000, 1024000,
                    TimeSpan.Zero, TimeSpan.Zero, 60);

                _NetM = new net.CClient(
                    _LinkM, _LinkFailM, _UnLinkM, _RecvM,
                    false, 1024000, 1024000,
                    TimeSpan.Zero, TimeSpan.Zero, 60);

                _NetS = new net.CClient(
                    _LinkS, _LinkFailS, _UnLinkS, _RecvS,
                    true, 1024000, 1024000,
                    TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(5), 60);

                _LinkFunc       = LinkFunc_;
                _LinkFailFunc   = LinkFailFunc_;
                _UnLinkFunc     = UnLinkFunc_;
                _UnLinkSoftFunc = UnLinkSoftFunc_;
                _RecvFunc       = RecvFunc_;
                _CheckFunc      = CheckFunc_;
                _CheckFailFunc  = CheckFailFunc_;
            }
Beispiel #2
0
            public void InitFunc(TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_)
            {
                _LinkFailFunc = LinkFailFunc_;
                _UnLinkFunc   = UnLinkFunc_;

                foreach (var Peer in _Peers)
                {
                    Peer.InitFunc(LinkFunc_, RecvFunc_);
                }
            }
Beispiel #3
0
            public CClient(TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_)
            {
                _Net = new net.CClient(
                    _Link, _LinkFail, _UnLink, _Recv,
                    false, 1024000, 1024000,
                    TimeSpan.FromMilliseconds(120000), TimeSpan.FromMilliseconds(60000), 60);

                _LinkFunc     = LinkFunc_;
                _LinkFailFunc = LinkFailFunc_;
                _UnLinkFunc   = UnLinkFunc_;
                _RecvFunc     = RecvFunc_;
            }
Beispiel #4
0
            public CClient(TLinkFunc LinkFuncS_, TLinkFailFunc LinkFailFuncS_, TUnLinkFunc UnLinkFuncS_, TRecvFunc RecvFuncS_)
            {
                _LinkFuncS     = LinkFuncS_;
                _LinkFailFuncS = LinkFailFuncS_;
                _UnLinkFuncS   = UnLinkFuncS_;
                _RecvFuncS     = RecvFuncS_;

                _NetS = new net.CClient(
                    _LinkS, _LinkFailS, _UnLinkS, _RecvS,
                    false, 1024000, 1024000,
                    TimeSpan.FromMilliseconds(120000), TimeSpan.FromMilliseconds(60000), 60);
            }
Beispiel #5
0
            public CClient(CNamePort ServerNamePort_, TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_)
            {
                _ServerNamePort = ServerNamePort_;
                _LinkFunc       = LinkFunc_;
                _LinkFailFunc   = LinkFailFunc_;
                _UnLinkFunc     = UnLinkFunc_;
                _RecvFunc       = RecvFunc_;

                _Net = new net.CClient(
                    _LinkS, _LinkFailS, _UnLinkS, _RecvS,
                    false, 1024000, 1024000,
                    new TimeSpan(200000000), new TimeSpan(90000000), 60);
            }
Beispiel #6
0
 public CClient(
     string FileName_, string ServerName_, bool VersionPath_, string DataPath_,
     TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_,
     TDownloadChangedFunc DownloadChangedFunc_, TDownloadCompletedFunc DownloadCompletedFunc_) :
     base(FileName_, DataPath_)
 {
     _Http                  = new CHttp(1, _DownloadChanged, _DownloadCompleted);
     _ServerName            = ServerName_;
     _VersionPath           = VersionPath_;
     _LinkFunc              = LinkFunc_;
     _DownloadChangedFunc   = DownloadChangedFunc_;
     _DownloadCompletedFunc = DownloadCompletedFunc_;
     _NetB                  = new balance.CClient(_LinkS, LinkFailFunc_, UnLinkFunc_, _RecvS);
 }
Beispiel #7
0
            public CNet(TPeerCnt PeerCnt_, TimeSpan HBRcvDelay_, TimeSpan HBSndDelay_,
                        TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_, bool NoDelay_)
            {
                _LinkFailFunc = LinkFailFunc_;
                _UnLinkFunc   = UnLinkFunc_;

                _Peers = new CPeer[PeerCnt_];
                for (Int32 i = 0; i < _Peers.Length; ++i)
                {
                    _Peers[i] = new CPeer(HBRcvDelay_, HBSndDelay_, LinkFunc_, _LinkFail, _UnLink, RecvFunc_);
                }

                _NoDelay = NoDelay_;
            }
Beispiel #8
0
            public CClient(CNamePort AllocatorNamePort_, string DataPath_, TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_)
            {
                _AllocatorNamePort = AllocatorNamePort_;
                _DataPath          = DataPath_;
                _Net = new net.CClient(
                    _Link, _LinkFail, _UnLink, _Recv,
                    false, 1024000, 1024000,
                    TimeSpan.FromMilliseconds(120000), TimeSpan.FromMilliseconds(60000), 60);

                _LinkFunc     = LinkFunc_;
                _LinkFailFunc = LinkFailFunc_;
                _UnLinkFunc   = UnLinkFunc_;
                _RecvFunc     = RecvFunc_;
            }
Beispiel #9
0
            public CClient(
                TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_,
                bool NoDelay_, Int32 RecvBuffSize_, Int32 SendBuffSize_,
                TimeSpan HBRcvDelay_, TimeSpan HBSndDelay_, Int32 ConnectTimeOutSec_,
                TLinkFunc LinkFuncSoft_, TUnLinkFunc UnLinkFuncSoft_, TimeSpan KeepConnectDuration_) :
                base(KeepConnectDuration_, LinkFunc_, UnLinkFunc_, RecvFunc_)
            {
                _LinkFailFunc   = LinkFailFunc_;
                _LinkFuncSoft   = LinkFuncSoft_;
                _UnLinkFuncSoft = UnLinkFuncSoft_;

                _Net = new net.CClient(
                    _LinkCallback, _LinkFailCallback, _UnLinkCallback, _RecvCallback,
                    NoDelay_, RecvBuffSize_, SendBuffSize_,
                    HBRcvDelay_, HBSndDelay_, ConnectTimeOutSec_);
            }
Beispiel #10
0
 public CAgent(
     string FileName_, string DataPath_,
     CNamePort MasterNamePort_, TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_,
     TDataFunc DataFunc_) :
     base(FileName_, DataPath_)
 {
     _MasterNamePort = MasterNamePort_;
     _LinkFunc       = LinkFunc_;
     _LinkFailFunc   = LinkFailFunc_;
     _UnLinkFunc     = UnLinkFunc_;
     _DataFunc       = DataFunc_;
     _NetM           = new net.CClient(
         _LinkM, _LinkFailM, _UnLinkM, _RecvM,
         false, 1024000, 1024000,
         TimeSpan.FromMilliseconds(30000), TimeSpan.FromMilliseconds(20000), 60);
 }
Beispiel #11
0
            public CPeer(TimeSpan HBRcvDelay_, TimeSpan HBSndDelay_, TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_)
            {
                _LinkFunc     = LinkFunc_;
                _LinkFailFunc = LinkFailFunc_;
                _UnLinkFunc   = UnLinkFunc_;
                _RecvFunc     = RecvFunc_;

                if (HBRcvDelay_.TotalSeconds > 0.0)
                {
                    _HBRcvPeriod = new CPeriod(HBRcvDelay_ + new TimeSpan(0, 0, 0, 0, 3000));
                }

                if (HBSndDelay_.TotalSeconds > 0.0)
                {
                    _HBSndPeriod = new CPeriod(HBSndDelay_);
                }
            }
Beispiel #12
0
 public CClient(
     TLinkFunc LinkFunc_, TLinkFailFunc LinkFailFunc_, TUnLinkFunc UnLinkFunc_, TRecvFunc RecvFunc_,
     bool NoDelay_, Int32 RecvBuffSize_, Int32 SendBuffSize_,
     TimeSpan HBRcvDelay_, TimeSpan HBSndDelay_, Int32 ConnectTimeOutSec_) :
     base(
         null, null, RecvFunc_,
         NoDelay_,
         HBRcvDelay_, HBSndDelay_)
 {
     _ConnectTimeOut  = new CConnectTimeOut(ConnectTimeOutSec_);
     base._LinkFunc   = _LinkCallback;
     base._UnLinkFunc = _UnLinkCallback;
     _LinkFunc        = LinkFunc_;
     _LinkFailFunc    = LinkFailFunc_;
     _UnLinkFunc      = UnLinkFunc_;
     _RecvFunc        = RecvFunc_;
     _SendBuffSize    = SendBuffSize_;
     _RecvBuffSize    = RecvBuffSize_;
 }