private void BeginSend(IoBuffer buf, EndPoint destination) { ArraySegment<Byte> array = buf.GetRemaining(); try { Socket.BeginSendTo(array.Array, array.Offset, array.Count, SocketFlags.None, destination, SendCallback, new SendingContext(Socket, buf)); } catch (ObjectDisposedException) { // ignore } catch (Exception ex) { EndSend(ex); } }
/// <inheritdoc/> protected override void BeginSend(IWriteRequest request, IoBuffer buf) { ArraySegment<Byte> array = buf.GetRemaining(); try { Socket.BeginSend(array.Array, array.Offset, array.Count, SocketFlags.None, SendCallback, new SendingContext(Socket, buf)); } catch (ObjectDisposedException) { // ignore } catch (Exception ex) { EndSend(ex); } }
private void BeginSend(AsyncDatagramSession session, IoBuffer buf, EndPoint remoteEP) { ArraySegment<Byte> array = buf.GetRemaining(); try { Socket.BeginSendTo(array.Array, array.Offset, array.Count, SocketFlags.None, remoteEP, SendCallback, session); } catch (ObjectDisposedException) { // ignore } catch (Exception ex) { EndSend(session, ex); } }
private void BeginSend(IoBuffer buf) { ArraySegment<Byte> array = buf.GetRemaining(); try { //make sync. add by zesus19 _serialPort.Write(array.Array, array.Offset, array.Count); Int32 written = buf.Remaining; buf.Position += written; EndSend(written); //delete async //_serialPort.BaseStream.BeginWrite(array.Array, array.Offset, array.Count, SendCallback, buf); } catch (ObjectDisposedException) { // ignore } catch (Exception ex) { this.FilterChain.FireExceptionCaught(ex); //add by zesus19 Processor.Remove(this); } }
/// <inheritdoc/> public override ArraySegment <Byte> GetRemaining() { return(_buf.GetRemaining()); }
/// <inheritdoc/> protected override void PutInternal(IoBuffer src) { ArraySegment<Byte> array = src.GetRemaining(); if (array.Count > Remaining) throw new OverflowException(); PutInternal(array.Array, array.Offset, array.Count); src.Position += array.Count; }
private void BeginSend(IoBuffer buf) { ArraySegment<Byte> array = buf.GetRemaining(); try { _serialPort.BaseStream.BeginWrite(array.Array, array.Offset, array.Count, SendCallback, buf); } catch (ObjectDisposedException) { // ignore } catch (Exception ex) { this.FilterChain.FireExceptionCaught(ex); } }