/// <summary> /// 发送消息 /// </summary> /// <typeparam name="T">泛型</typeparam> /// <param name="channel">通信协议</param> /// <param name="type">数据包类型</param> /// <param name="tobject">要发送的内容</param> public void SendBuff <T>(int channel, int type, T tobject, bool OffCheckTimeOut = false) { if (type < 0 || type > 1) { throw new Exception("数据类型异常"); } NSocketModel.AddSendBuff(channel, type, tobject, OffCheckTimeOut); }
/// <summary> /// 启动该连接 /// </summary> public void StartTcpConnection() { if (ServerAddress == null) { throw new Exception("服务器地址为空,无法启动连接"); } if (IsConnected) { throw new Exception("已连接,请断开后重试"); } NSocketModel.TcpConnecting(); }
/// <summary> /// 停止该连接 /// </summary> public void StopTcpConnection() { NSocketModel.Close(); }