示例#1
0
        internal SocketError WSARecvMsgBlocking(IntPtr socketHandle, IntPtr msg, out int bytesTransferred, IntPtr overlapped, IntPtr completionRoutine)
        {
            EnsureDynamicWinsockMethods();
            WSARecvMsgDelegateBlocking recvMsg_Blocking = _dynamicWinsockMethods.GetDelegate <WSARecvMsgDelegateBlocking>(_handle);

            return(recvMsg_Blocking(socketHandle, msg, out bytesTransferred, overlapped, completionRoutine));
        }
示例#2
0
 private void EnsureWSARecvMsg(SafeCloseSocket socketHandle)
 {
     if (_recvMsg == null)
     {
         lock (_lockObject)
         {
             if (_recvMsg == null)
             {
                 Guid   guid          = new Guid("{0xf689d7c8,0x6f1f,0x436b,{0x8a,0x53,0xe5,0x4f,0xe3,0x51,0xc3,0x22}}");
                 IntPtr ptrWSARecvMsg = LoadDynamicFunctionPointer(socketHandle, ref guid);
                 _recvMsgBlocking = Marshal.GetDelegateForFunctionPointer <WSARecvMsgDelegateBlocking>(ptrWSARecvMsg);
                 Volatile.Write(ref _recvMsg, Marshal.GetDelegateForFunctionPointer <WSARecvMsgDelegate>(ptrWSARecvMsg));
             }
         }
     }
 }