/// <summary> /// 关闭Socket回调 /// </summary> /// <param name="type"></param> /// <param name="state"></param> /// <param name="socketCode"></param> /// <param name="socketMessage"></param> private void CloseSocket(CloseType type, Exception e = null) { //关闭套接字 socket.Close(); logger.Log("断开TCP成功!"); //引发断线事件 if (onCloseSocket != null) { onCloseSocket(type, currentState, e); } }
//停止连接 public void Stop() { currentState = SocketState.CLOSE; try { //关闭套接字 socket.Close(); isClose = true; logger.Log("断开UDP成功!"); } catch (Exception exp) { //引发错误事件 CallError(exp); } }
void Start() { Audio.OnLoad.Subscribe(_ => IDebuger.Log("OnLoad Subscribe!")); }