Example #1
0
        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);
        }
Example #2
0
 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);
 }
Example #3
0
 private static IAsyncResult WriteMultipleBegin(SocketStream1 thisRef, ArraySegment <byte>[] args, AsyncCallback callback, object state)
 {
     return(thisRef.Socket.BeginSend(args, SocketFlags.None, callback, state));
 }
Example #4
0
 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));
 }