Exemplo n.º 1
0
        private void OnConnectionClosed(PosixTimeval timeval, TcpConnection con, TcpPacket tcp, TcpConnection.CloseType closeType)
        {
            if (OnTCPConnectClosed != null)
            {
                TCPConnectionInfo ti = new TCPConnectionInfo();
                ti.SrcIP    = con.Flows[0].address;
                ti.SrcPort  = con.Flows[0].port;
                ti.DestIP   = con.Flows[1].address;
                ti.DestPort = con.Flows[1].port;

                ti.DeviceId = DeviceId.ToString();

                TCPConnectionArg arg = new TCPConnectionArg();
                arg.ConnectionInfo = ti;

                OnTCPConnectClosed(arg);
            }
        }
Exemplo n.º 2
0
        private void OnConnectionFound(TcpConnection con)
        {
            TCPConnectionInfo ti = new TCPConnectionInfo();

            ti.SrcIP    = con.Flows[0].address;
            ti.SrcPort  = con.Flows[0].port;
            ti.DestIP   = con.Flows[1].address;
            ti.DestPort = con.Flows[1].port;

            ti.DeviceId = DeviceId.ToString();

            if (OnTCPConnectOpened != null)
            {
                TCPConnectionArg arg = new TCPConnectionArg();
                arg.ConnectionInfo = ti;

                OnTCPConnectOpened.BeginInvoke(arg, null, null);
            }

            // receive notifications when the connection is closed
            con.OnConnectionClosed += this.OnConnectionClosed;
        }