void Udp_Received(object sender, NetEventArgs e) { // 判断是否当前远程地址 if (!Connected) { // 如果不是当前远程地址,则不触发已收到事件 if (e.RemoteEndPoint + "" != RemoteEndPoint + "") return; } if (Received != null) Received(this, new ReceivedEventArgs(e.GetStream())); }
void TcpClientX_Received(object sender, NetEventArgs e) { if (_Received != null) _Received(this, new ReceivedEventArgs(e.GetStream())); }
/// <summary> /// 已重载。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void OnReceived(object sender, NetEventArgs e) { if (e.BytesTransferred > 0) StreamHandler.Process(StreamHandlerName, e.GetStream()); }