internal RioConnectionOrientedSocket(IntPtr overlapped, IntPtr adressBuffer, RioConnectionOrientedSocketPool pool, RioFixedBufferPool sendBufferPool, RioFixedBufferPool receiveBufferPool,
     uint maxOutstandingReceive, uint maxOutstandingSend, IntPtr SendCompletionQueue, IntPtr ReceiveCompletionQueue)
     : base(sendBufferPool, receiveBufferPool, maxOutstandingReceive, maxOutstandingSend, SendCompletionQueue, ReceiveCompletionQueue,
         ADDRESS_FAMILIES.AF_INET, SOCKET_TYPE.SOCK_STREAM, PROTOCOL.IPPROTO_TCP)
 {
     _overlapped = (RioNativeOverlapped*)overlapped.ToPointer();
     _eventHandle = Kernel32.CreateEvent(IntPtr.Zero, false, false, null);
     _adressBuffer = adressBuffer;
     _pool = pool;
     unsafe
     {
         var n = (NativeOverlapped*)overlapped.ToPointer();
         n->EventHandle = _eventHandle;
     }
 }
Beispiel #2
0
 internal RioConnectionOrientedSocket(IntPtr overlapped, IntPtr adressBuffer, RioConnectionOrientedSocketPool pool, RioFixedBufferPool sendBufferPool, RioFixedBufferPool receiveBufferPool,
                                      uint maxOutstandingReceive, uint maxOutstandingSend, IntPtr SendCompletionQueue, IntPtr ReceiveCompletionQueue,
                                      ADDRESS_FAMILIES adressFam, SOCKET_TYPE sockType, PROTOCOL protocol) :
     base(sendBufferPool, receiveBufferPool, maxOutstandingReceive, maxOutstandingSend, SendCompletionQueue, ReceiveCompletionQueue,
          adressFam, sockType, protocol) //ADDRESS_FAMILIES.AF_INET, SOCKET_TYPE.SOCK_STREAM, PROTOCOL.IPPROTO_TCP
 {
     _overlapped   = (RioNativeOverlapped *)overlapped.ToPointer();
     _eventHandle  = Kernel32.CreateEvent(IntPtr.Zero, false, false, null);
     _adressBuffer = adressBuffer;
     _pool         = pool;
     unsafe
     {
         var n = (NativeOverlapped *)overlapped.ToPointer();
         n->EventHandle = _eventHandle;
     }
 }
 internal RioConnectionOrientedSocket(ulong socketid, IntPtr overlapped, IntPtr adressBuffer, RioConnectionOrientedSocketPool pool, RioFixedBufferPool sendBufferPool, RioFixedBufferPool receiveBufferPool, RioFixedBufferPool adressBufferPool,
                                      uint maxOutstandingReceive, uint maxOutstandingSend, IntPtr SendCompletionQueue, IntPtr ReceiveCompletionQueue,
                                      ADDRESS_FAMILIES adressFam, SOCKET_TYPE sockType, PROTOCOL protocol) :
     base(sendBufferPool, receiveBufferPool, adressBufferPool, maxOutstandingReceive, maxOutstandingSend, SendCompletionQueue, ReceiveCompletionQueue,
          adressFam, sockType, protocol)
 {
     _overlapped      = (RioNativeOverlapped *)overlapped.ToPointer();
     _adressBuffer    = adressBuffer;
     _pool            = pool;
     onreadCompletion = id => { if (id == currentId)
                                {
                                    Interlocked.Decrement(ref pendingRecives);
                                }
     };
     onSendCompletion = id => { if (id == currentId)
                                {
                                    Interlocked.Decrement(ref pendingSends);
                                }
     };
     sendTimeout    = Stopwatch.Frequency * 5;
     receiveTimeout = Stopwatch.Frequency * 5;
     currentId      = socketid;
 }