/// <summary>
        /// listen and wait for peer connect
        /// </summary>
        /// <param name="localIpAddress"></param>
        /// <param name="port"></param>
        /// <param name="ipFamily">IP Family IPv4 or IPv6</param>
        /// <returns></returns>
        public NtStatus ListenConnection(String localIpAddress, ushort port, AddressFamily ipFamily)
        {
            if (initializeStatus != NtStatus.STATUS_SUCCESS)
            {
                return(initializeStatus);
            }

            rdmaAdapter = OpenAdapter(rdmaProvidersList, localIpAddress, ipFamily, logEndpointEvent);
            if (rdmaAdapter == null)
            {
                // this is the return code of NDSPI
                return(NtStatus.STATUS_NOT_SUPPORTED);
            }

            // listen and get incoming connection request
            RdmaListen listen;
            NtStatus   status = (NtStatus)rdmaAdapter.Listen(6 /* tcp */, port, out listen);

            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // create connector
            status = (NtStatus)rdmaAdapter.CreateConnector(out rdmaConnector);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // wait for connection
            status = (NtStatus)listen.GetConnectionRequest(rdmaConnector);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // create completion queue and endpoint
            status = (NtStatus)rdmaAdapter.CreateCompletionQueue(this.completionQueueDepth,
                                                                 out this.rdmaCompletionQueue);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }
            status = (NtStatus)this.rdmaConnector.CreateEndpoint(
                rdmaCompletionQueue,
                inboundEntries,
                outboundEntries,
                1,
                1,
                inboundReadLimit,
                0,
                out rdmaMaxInlineData,
                out rdmaEndpoint);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // accept the arrival RDMA connection
            status = (NtStatus)this.rdmaConnector.Accept(rdmaEndpoint);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            CompleteConnect();
            return(NtStatus.STATUS_SUCCESS);
        }
        /// <summary>
        /// listen and wait for peer connect
        /// </summary>
        /// <param name="localIpAddress"></param>
        /// <param name="port"></param>
        /// <param name="ipFamily">IP Family IPv4 or IPv6</param>
        /// <returns></returns>
        public NtStatus ListenConnection(String localIpAddress, ushort port, AddressFamily ipFamily)
        {
            if (initializeStatus != NtStatus.STATUS_SUCCESS)
            {
                return initializeStatus;
            }

            rdmaAdapter = OpenAdapter(rdmaProvidersList, localIpAddress, ipFamily, logEndpointEvent);
            if (rdmaAdapter == null)
            {
                // this is the return code of NDSPI
                return NtStatus.STATUS_NOT_SUPPORTED;
            }

            // listen and get incoming connection request
            RdmaListen listen;
            NtStatus status = (NtStatus)rdmaAdapter.Listen(6/* tcp */, port, out listen);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // create connector
            status = (NtStatus)rdmaAdapter.CreateConnector(out rdmaConnector);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // wait for connection
            status = (NtStatus)listen.GetConnectionRequest(rdmaConnector);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // create completion queue and endpoint
            status = (NtStatus)rdmaAdapter.CreateCompletionQueue(this.completionQueueDepth,
                out this.rdmaCompletionQueue);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }
            status = (NtStatus)this.rdmaConnector.CreateEndpoint(
                rdmaCompletionQueue,
                inboundEntries,
                outboundEntries,
                1,
                1,
                inboundReadLimit,
                0,
                out rdmaMaxInlineData,
                out rdmaEndpoint);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // accept the arrival RDMA connection
            status = (NtStatus)this.rdmaConnector.Accept(rdmaEndpoint);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            CompleteConnect();
            return NtStatus.STATUS_SUCCESS;
        }
        /// <summary>
        /// establish connection over RDMA
        /// </summary>
        /// <param name="localIpAddress">local IP address</param>
        /// <param name="remoteIpAddress">remote IP address</param>
        /// <param name="port">port</param>
        /// <param name="ipFamily">IP Family</param>
        /// <returns></returns>
        public NtStatus ConnectToServerOverRdma(
            String localIpAddress,
            String remoteIpAddress,
            UInt16 port,
            AddressFamily ipFamily)
        {
            if (initializeStatus != NtStatus.STATUS_SUCCESS)
            {
                return(initializeStatus);
            }

            rdmaAdapter = OpenAdapter(rdmaProvidersList, localIpAddress, ipFamily, logEndpointEvent);
            if (rdmaAdapter == null)
            {
                // this is the return code of NDSPI
                return(NtStatus.STATUS_NOT_SUPPORTED);
            }

            // create completion queue
            NtStatus status = (NtStatus)rdmaAdapter.CreateCompletionQueue(
                this.completionQueueDepth,
                out this.rdmaCompletionQueue
                );

            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // connector
            status = (NtStatus)rdmaAdapter.CreateConnector(out this.rdmaConnector);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // create endpoint
            status = (NtStatus)rdmaConnector.CreateEndpoint(
                rdmaCompletionQueue,
                inboundEntries,
                outboundEntries,
                1,
                1,
                inboundReadLimit,
                0,
                out rdmaMaxInlineData,
                out rdmaEndpoint);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // connect to server
            status = (NtStatus)rdmaConnector.Connect(rdmaEndpoint, remoteIpAddress, port, 6 /* for tcp */);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            // complete connection and then can do RDMA operations
            status = (NtStatus)rdmaConnector.CompleteConnect();
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return(status);
            }

            CompleteConnect();
            return(NtStatus.STATUS_SUCCESS);
        }
        /// <summary>
        /// establish connection over RDMA
        /// </summary>
        /// <param name="localIpAddress">local IP address</param>
        /// <param name="remoteIpAddress">remote IP address</param>
        /// <param name="port">port</param>
        /// <param name="ipFamily">IP Family</param>
        /// <returns></returns>
        public NtStatus ConnectToServerOverRdma(
            String localIpAddress,
            String remoteIpAddress,
            UInt16 port,
            AddressFamily ipFamily)
        {
            if (initializeStatus != NtStatus.STATUS_SUCCESS)
            {
                return initializeStatus;
            }

            rdmaAdapter = OpenAdapter(rdmaProvidersList, localIpAddress, ipFamily, logEndpointEvent);
            if (rdmaAdapter == null)
            {
                // this is the return code of NDSPI
                return NtStatus.STATUS_NOT_SUPPORTED;
            }

            // create completion queue
            NtStatus status = (NtStatus)rdmaAdapter.CreateCompletionQueue(
                this.completionQueueDepth,
                out this.rdmaCompletionQueue
                );
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // connector
            status = (NtStatus)rdmaAdapter.CreateConnector(out this.rdmaConnector);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // create endpoint
            status = (NtStatus)rdmaConnector.CreateEndpoint(
                rdmaCompletionQueue,
                inboundEntries,
                outboundEntries,
                1,
                1,
                inboundReadLimit,
                0,
                out rdmaMaxInlineData,
                out rdmaEndpoint);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // connect to server
            status = (NtStatus)rdmaConnector.Connect(rdmaEndpoint, remoteIpAddress, port, 6 /* for tcp */);
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            // complete connection and then can do RDMA operations
            status = (NtStatus)rdmaConnector.CompleteConnect();
            if (status != NtStatus.STATUS_SUCCESS)
            {
                return status;
            }

            CompleteConnect();
            return NtStatus.STATUS_SUCCESS;
        }