public CKey Connect(TPeerCnt PeerNum_, string DataPath_, CNamePort MasterNamePort_) { var FullPath = Path.GetFullPath(DataPath_); var FileName = FullPath + "Data_" + PeerNum_.ToString() + ".bin"; _Servers.AddAt((Int32)PeerNum_, new _SServer(_PeerCounter, MasterNamePort_, FileName)); if (!_Connect(PeerNum_)) { return(new CKey()); } return(new CKey(PeerNum_, _PeerCounter++)); }
public bool Login(TPeerCnt PeerNum_, string DataPath_, CNamePort HubNamePort_, string ID_, TUID SubUID_, CStream Stream_) { var itClient = _Clients.AddAt((Int32)PeerNum_, new _SClient(PeerNum_, DataPath_, HubNamePort_, SubUID_, Stream_)); var NodeToConnect = itClient.Data.GetNodeToConnect(ID_); if (NodeToConnect == _ENode.Null) { _Clients.Remove(itClient); return(false); } _ConnectToUpper(PeerNum_, NodeToConnect); return(true); }
protected void _Link(CKey Key_, Socket Socket_, SocketAsyncEventArgs Event_) { Event_.UserToken = Key_; var NamePort = new CNamePort((IPEndPoint)Event_.RemoteEndPoint); _Peers.AddAt((Int32)Key_.PeerNum, new CPeer(_HeaderSize, _HBRcvDelay, _HBSndDelay, Socket_, Key_, NamePort)); try { _LinkFunc(Key_, NamePort); } catch (Exception Exception_) { throw new ExceptionNet(ENetRet.ExceptionExternal, Exception_); } }
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); }
void _LinkA(CKey Key_, CNamePort NamePort_) { switch (_Clients[(Int32)Key_.PeerNum].CaProto) { case EProto.CaCreate: _NetA.Send(Key_.PeerNum, new SHeader(_Clients[(Int32)Key_.PeerNum].CaProto), new SCaCreate(_Clients[(Int32)Key_.PeerNum].ID, _Clients[(Int32)Key_.PeerNum].Nick)); break; case EProto.CaLogin: _NetA.Send(Key_.PeerNum, new SHeader(_Clients[(Int32)Key_.PeerNum].CaProto), new SCaLogin(_Clients[(Int32)Key_.PeerNum].UID, _Clients[(Int32)Key_.PeerNum].ID)); break; case EProto.CaCheck: _NetA.Send(Key_.PeerNum, new SHeader(_Clients[(Int32)Key_.PeerNum].CaProto), new SCaCheck(_Clients[(Int32)Key_.PeerNum].ID)); break; } }
public CPeer(Int32 HeaderSize_, TimeSpan HBRcvDelay_, TimeSpan HBSndDelay_, Socket Socket_, CKey Key_, CNamePort NamePort_) { _RecvBuf = new Byte[40960]; _HeaderSize = HeaderSize_; if (HBRcvDelay_.TotalSeconds > 0.0) { _HBRcvPeriod = new CPeriod(HBRcvDelay_ + TimeSpan.FromSeconds(3)); _HBRcvPeriod.NextLoose(); } if (HBSndDelay_.TotalSeconds > 0.0) { _HBSndPeriod = new CPeriod(HBSndDelay_); } _Socket = Socket_; _Key = Key_; _NamePort = NamePort_; }
public CKey Connect(CNamePort NamePort_, TPeerCnt PeerNum_) { try { var itPeerConnecting = _PeersAndConnectings.AddAt((Int32)PeerNum_, _NewKey(PeerNum_)); try { _Connectings.AddAt((Int32)PeerNum_, NamePort_); } catch { _PeersAndConnectings.Remove(itPeerConnecting); throw; } return(itPeerConnecting.Data); } catch { return(null); } }
void _LinkS(CKey Key_, CNamePort NamePort_) { _NetS.Send(Key_.PeerNum, new SHeader(EProto.CsConnect), new SCsConnect(_Servers[(Int32)Key_.PeerNum].PrevConnectNamePort)); _Servers[(Int32)Key_.PeerNum].PrevConnectNamePort = NamePort_; }
void _LinkS(CKey Key_, CNamePort NamePort_) { _NetB.Send(Key_.PeerNum, new SHeader(EProto.CsLogin), new SCsLogin(_Data.Data.Version)); _LinkFunc(Key_, NamePort_); }
void LinkSoft(CKey Key_, CNamePort NamePort_) { _Log("LinkFuncSoft"); }
public CKey Connect(TPeerCnt PeerNum_, string DataPath_, CNamePort MasterNamePort_) { return(_NetB.Connect(PeerNum_, DataPath_, MasterNamePort_)); }
public CKey Connect(string DataPath_, CNamePort MasterNamePort_) { return(_NetB.Connect(DataPath_, MasterNamePort_)); }
static void Link(CKey Key_, CNamePort NamePort_) { Clients.Add(Key_, new SData()); Console.WriteLine("Link:" + Key_.PeerNum); }
public CKey Connect(string DataPath_, CNamePort MasterNamePort_) { return(Connect((TPeerCnt)_Servers.NewIndex, DataPath_, MasterNamePort_)); }
public void Create(TPeerCnt PeerNum_, string DataPath_, CNamePort AuthNamePort_, string ID_, string Nick_, TUID SubUID_, CStream Stream_) { _Clients.AddAt((Int32)PeerNum_, new _SClient(PeerNum_, DataPath_, AuthNamePort_, ID_, Nick_, SubUID_, Stream_)); _ConnectToUpper(PeerNum_, _ENode.Auth); }
public bool Connect(string DataPath_, CNamePort AllocatorNamePort_) { return(Connect((TPeerCnt)_Servers.NewIndex, DataPath_, AllocatorNamePort_)); }
void _LinkM(CKey Key_, CNamePort NamePort_) { _NetM.Send(Key_.PeerNum, new SHeader(EProto.AmLogin), new SAmLogin(_ID, _PW, _Data.Data.Version)); _LinkFunc(Key_, NamePort_); }
void _Link(CKey Key_, CNamePort NamePort_) { _Servers[(Int32)Key_.PeerNum].Key = Key_; }
static void Link(CKey Key_, CNamePort NamePort_) { Console.WriteLine("Link:" + Key_.PeerNum.ToString()); }
void Link(CKey Key_, CNamePort NamePort_) { }
static void Link(CKey Key_, CNamePort NamePort_ ) { _Key = Key_; Console.WriteLine("Link:" + Key_.PeerNum); }
void _LinkS(CKey Key_, CNamePort NamePort_) { var Client = _Clients[(Int32)Key_.PeerNum]; _NetS.Send(Key_.PeerNum, new SHeader(EProto.CsLogin), new SCsLogin(Client.UID, Client.ID, Client.SubUID, Client.SessionCode, _Version, Client.IsCreate(), Client.Stream)); }
void _LinkCallback(CKey Key_, CNamePort NamePort_) { _ConnectTimeOut.Remove((Int32)Key_.PeerNum); _LinkFunc(Key_, NamePort_); }
public void Create(string DataPath_, CNamePort AuthNamePort_, string ID_, string Nick_, TUID SubUID_, CStream Stream_) { Create((TPeerCnt)_Clients.NewIndex, DataPath_, AuthNamePort_, ID_, Nick_, SubUID_, Stream_); }
void _LinkS(CKey Key_, CNamePort NamePort_) { _ServerKey = Key_; _LinkFunc(Key_, NamePort_); _Net.Send(Key_.PeerNum, new SCsHeader(ECsProto.Login, new List <SKey>()), _LoginInfo); }
public bool Login(string DataPath_, CNamePort AuthNamePort_, string ID_, TUID SubUID_, CStream Stream_) { return(Login((TPeerCnt)_Clients.NewIndex, DataPath_, AuthNamePort_, ID_, SubUID_, Stream_)); }
public bool HaveBeenLinked = false; // 한번이라도 IsLinked 가 true 인 적이 있었는가? (한번 IsLinked 가 true가 되면 _SPeerExt가 제거되기 전까지 연결된 상태이므로 외부에서의 Linked) public _SPeerExt(CKey Key_, CNamePort NamePort_) : base(Key_) { NamePort = NamePort_; }
static void LinkSoft(CKey Key_, CNamePort NamePort_) { Console.WriteLine("LinkSoft:" + Key_.PeerNum); }
public CKey Connect(CNamePort NamePort_) { return(Connect(NamePort_, (TPeerCnt)_PeersExt.NewIndex)); }