Exemplo n.º 1
0
        private Delegate LoadDynamicMethod(Guid guid, Type type)
        {
            IntPtr connectExAddress = IntPtr.Zero;
            int    byteTransfered   = 0;

            SocketError socketError = (SocketError)UnsafeMethods.WSAIoctl(Handle, UnsafeMethods.GetExtensionFunctionPointer,
                                                                          ref guid, Marshal.SizeOf(guid), ref connectExAddress, IntPtr.Size, ref byteTransfered, IntPtr.Zero, IntPtr.Zero);

            if (socketError != SocketError.Success)
            {
                throw new SocketException();
            }

            return(Marshal.GetDelegateForFunctionPointer(connectExAddress, type));
        }