private static int ReadEndMethod(SocketStream1 thisRef, IAsyncResult asyncResult) { var read = thisRef.Socket.EndReceive(asyncResult); thisRef.OnAsyncReadCompleted(read); if (read == 0) { thisRef.State |= MyStreamState.RemoteShutdown; } return(read); }
private static VoidType WriteEndMethod(SocketStream1 thisRef, IAsyncResult asyncResult) { if (asyncResult.CompletedSynchronously) { Interlocked.Increment(ref ctr.Wsync); } else { Interlocked.Increment(ref ctr.Wasync); } thisRef.Socket.EndSend(asyncResult); return(VoidType.Void); }
private static IAsyncResult WriteMultipleBegin(SocketStream1 thisRef, ArraySegment <byte>[] args, AsyncCallback callback, object state) { return(thisRef.Socket.BeginSend(args, SocketFlags.None, callback, state)); }
private static IAsyncResult WriteBeginMethod(SocketStream1 thisRef, BytesSegment args, AsyncCallback callback, object state) { return(thisRef.Socket.BeginSend(args.Bytes, args.Offset, args.Len, SocketFlags.None, callback, state)); }