Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TcpRow"/> class.
        /// </summary>
        /// <param name="tcpRow">TcpRow struct.</param>
        internal TcpRow(NativeMethods.TcpRow tcpRow)
        {
            ProcessId = tcpRow.owningPid;

            LocalPort    = tcpRow.GetLocalPort();
            LocalAddress = tcpRow.localAddr;

            RemotePort    = tcpRow.GetRemotePort();
            RemoteAddress = tcpRow.remoteAddr;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TcpRow"/> class.
        /// </summary>
        /// <param name="tcpRow">TcpRow struct.</param>
        public TcpRow(NativeMethods.TcpRow tcpRow)
        {
            ProcessId = tcpRow.owningPid;

            int  localPort    = (tcpRow.localPort1 << 8) + (tcpRow.localPort2) + (tcpRow.localPort3 << 24) + (tcpRow.localPort4 << 16);
            long localAddress = tcpRow.localAddr;

            LocalEndPoint = new IPEndPoint(localAddress, localPort);

            int  remotePort    = (tcpRow.remotePort1 << 8) + (tcpRow.remotePort2) + (tcpRow.remotePort3 << 24) + (tcpRow.remotePort4 << 16);
            long remoteAddress = tcpRow.remoteAddr;

            RemoteEndPoint = new IPEndPoint(remoteAddress, remotePort);
        }
 /// <summary>
 /// Gets the remote port from a native TCP row object.
 /// </summary>
 /// <param name="tcpRow">The TCP row.</param>
 /// <returns>The remote port</returns>
 internal static int GetRemotePort(this NativeMethods.TcpRow tcpRow)
 {
     return((tcpRow.remotePort1 << 8) + tcpRow.remotePort2 + (tcpRow.remotePort3 << 24) + (tcpRow.remotePort4 << 16));
 }