mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] 接入ET8服务端
[+] 接入ET8服务端
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace ET.Server
|
||||
{
|
||||
|
||||
[ComponentOf(typeof(Scene))]
|
||||
public class RouterComponent: Entity, IAwake<IPEndPoint, string>, IDestroy, IUpdate
|
||||
{
|
||||
public Socket OuterSocket;
|
||||
public Socket InnerSocket;
|
||||
public EndPoint IPEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
|
||||
public byte[] Cache = new byte[1500];
|
||||
|
||||
public Dictionary<uint, RouterNode> ConnectIdNodes = new Dictionary<uint, RouterNode>();
|
||||
|
||||
// 已经连接成功的,虽然跟id一样,但是没有经过验证的不会加到这里
|
||||
public Dictionary<uint, RouterNode> OuterNodes = new Dictionary<uint, RouterNode>();
|
||||
|
||||
public long LastCheckTime = 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aedecff0d33048948a8204f5397a9530
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,36 @@
|
||||
using System.Net;
|
||||
|
||||
namespace ET.Server
|
||||
{
|
||||
public enum RouterStatus
|
||||
{
|
||||
Sync,
|
||||
Msg,
|
||||
}
|
||||
|
||||
[ChildOf(typeof(RouterComponent))]
|
||||
public class RouterNode: Entity, IDestroy, IAwake
|
||||
{
|
||||
public uint ConnectId;
|
||||
public string InnerAddress;
|
||||
public IPEndPoint InnerIpEndPoint;
|
||||
public IPEndPoint OuterIpEndPoint;
|
||||
public IPEndPoint SyncIpEndPoint;
|
||||
public uint OuterConn;
|
||||
public uint InnerConn;
|
||||
public long LastRecvOuterTime;
|
||||
public long LastRecvInnerTime;
|
||||
|
||||
public int RouterSyncCount;
|
||||
public int SyncCount;
|
||||
|
||||
#region 限制外网消息数量,一秒最多50个包
|
||||
|
||||
public long LastCheckTime;
|
||||
public int LimitCountPerSecond;
|
||||
|
||||
#endregion
|
||||
|
||||
public RouterStatus Status;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e639e9551604860489a87b4cc5642ba4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user