// 初始化 public NetSocket(ServerTask _serverTaskCtx = null) { serverTask = _serverTaskCtx; unPackCache.buf = null; unPackCache.len = 0; if (serverTask == null) { return; } Server server = serverTask.GetServer(); SetDePacketor(server.dePacketor); unPackHeadLen = dePacketor.GetPackHeadPreLength(); UniqueID uniqueID = UniqueID.GetInstance(); if (server.serverTaskCount > 1) { id = uniqueID.gen_multi(); } else { id = uniqueID.gen(); } }
string localIP; // 本机IP地址 public Server() { serverTaskMgr = new ServerTaskMgr(this); dePacketor = new DePacketor(); SetUseSingleSendTaskProcesser(useSingleSendTaskProcesser); UniqueID.GetInstance(); }
public void ResetGenID() { UniqueID uniqueID = UniqueID.GetInstance(); Server server = GetServer(); if (server.serverTaskCount > 1) { id = uniqueID.gen_multi(); } else { id = uniqueID.gen(); } }
public void SetServerMachineID(int machineID) { UniqueID.GetInstance().set_workid(machineID); }