/// <summary> /// 尝试发送回复数据 /// </summary> /// <exception cref="SocketException"></exception> /// <exception cref="ArgumentNullException"></exception> /// <param name="response">回复内容</param> public bool TrySend(WebsocketResponse response) { try { this.Send(response); return(true); } catch (Exception) { return(false); } }
/// <summary> /// 发送回复数据 /// </summary> /// <exception cref="SocketException"></exception> /// <exception cref="ArgumentNullException"></exception> /// <param name="response">回复内容</param> public int Send(WebsocketResponse response) { return(this.session.Send(response.ToArraySegment(mask: false))); }
/// <summary> /// 发送回复数据 /// </summary> /// <exception cref="SocketException"></exception> /// <exception cref="ArgumentNullException"></exception> /// <param name="response">回复内容</param> public void Send(WebsocketResponse response) { this.session.Send(response.ToByteRange()); }