System.Net.SocketAddress.CopyAddressSizeIntoBuffer C# (CSharp) Метод

CopyAddressSizeIntoBuffer() приватный Метод

private CopyAddressSizeIntoBuffer ( ) : void
Результат void
        internal void CopyAddressSizeIntoBuffer()
        {
            m_Buffer[m_Buffer.Length-IntPtr.Size]   = unchecked((byte)(m_Size));
            m_Buffer[m_Buffer.Length-IntPtr.Size+1] = unchecked((byte)(m_Size >> 8));
            m_Buffer[m_Buffer.Length-IntPtr.Size+2] = unchecked((byte)(m_Size >> 16));
            m_Buffer[m_Buffer.Length-IntPtr.Size+3] = unchecked((byte)(m_Size >> 24));
        }
        //

Usage Example

        //
        // SetUnmanagedStructures -
        // Fills in Overlapped Structures used in an Async Overlapped Winsock call
        //   these calls are outside the runtime and are unmanaged code, so we need
        //   to prepare specific structures and ints that lie in unmanaged memory
        //   since the Overlapped calls can be Async
        //

        internal void SetUnmanagedStructures(byte[] buffer, int offset, int size, SocketAddress socketAddress, bool pinSocketAddress)
        {
            //
            // Fill in Buffer Array structure that will be used for our send/recv Buffer
            //
            m_SocketAddress = socketAddress;
            if (pinSocketAddress && m_SocketAddress != null)
            {
                object[]  objectsToPin = null;
                objectsToPin = new object[2];
                objectsToPin[0] = buffer;

                m_SocketAddress.CopyAddressSizeIntoBuffer();
                objectsToPin[1] = m_SocketAddress.m_Buffer;

                base.SetUnmanagedStructures(objectsToPin);
            } else {
                base.SetUnmanagedStructures(buffer);
            }

            m_SingleBuffer.Length = size;
            m_SingleBuffer.Pointer = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, offset);
        }
All Usage Examples Of System.Net.SocketAddress::CopyAddressSizeIntoBuffer