GetIPPacketInformation() 개인적인 정적인 메소드

private static GetIPPacketInformation ( System.Net.Interop messageHeader, bool isIPv4, bool isIPv6 ) : IPPacketInformation
messageHeader System.Net.Interop
isIPv4 bool
isIPv6 bool
리턴 IPPacketInformation
예제 #1
0
 private unsafe void InitIPPacketInformation()
 {
     if (_controlBuffer.Length == s_controlDataSize)
     {
         // IPv4
         _ipPacketInformation = SocketPal.GetIPPacketInformation((Interop.Winsock.ControlData *)_message->controlBuffer.Pointer);
     }
     else if (_controlBuffer.Length == s_controlDataIPv6Size)
     {
         // IPv6
         _ipPacketInformation = SocketPal.GetIPPacketInformation((Interop.Winsock.ControlDataIPv6 *)_message->controlBuffer.Pointer);
     }
     else
     {
         // Other
         _ipPacketInformation = new IPPacketInformation();
     }
 }
예제 #2
0
        private unsafe void InitIPPacketInformation()
        {
            int?controlBufferLength = _controlBuffer?.Length;

            if (controlBufferLength == sizeof(Interop.Winsock.ControlData))
            {
                // IPv4
                _ipPacketInformation = SocketPal.GetIPPacketInformation((Interop.Winsock.ControlData *)_message->controlBuffer.Pointer);
            }
            else if (controlBufferLength == sizeof(Interop.Winsock.ControlDataIPv6))
            {
                // IPv6
                _ipPacketInformation = SocketPal.GetIPPacketInformation((Interop.Winsock.ControlDataIPv6 *)_message->controlBuffer.Pointer);
            }
            else
            {
                // Other
                _ipPacketInformation = default;
            }
        }