private void Worker_OnTCPConnectOpened(TCPConnectionArg arg)
 {
     if (OnTCPConnectionOpened != null)
     {
         OnTCPConnectionOpened.BeginInvoke(arg, null, null);
     }
 }
        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);
            }
        }
        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;
        }