コード例 #1
0
        public void NicIsSelected(NetworkInterface nic)
        {
            pcs = new PcList();
            pcs.SetCallBackOnNewPC(CallbackOnNewPC);
            pcs.SetCallBackOnPCRemove(callbackOnPCRemove);
            nicNet = nic;
            /* modopt(System.Runtime.CompilerServices.IsConst) */
            CArp cArp = new CArp(nic, this.pcs);

            this.cArp = cArp;
            cArp.startArpListener();
            this.cArp.findMacRouter();
            PC pC = new PC()
            {
                ip        = new IPAddress(this.cArp.localIP),
                mac       = new PhysicalAddress(this.cArp.localMAC),
                CapDown   = 0,
                CapUp     = 0,
                isLocalPc = true,
                name      = "",
                nbPacketReceivedSinceLastReset = 0,
                nbPacketSentSinceLastReset     = 0,
                redirect            = false,
                timeSinceLastRarp   = DateTime.Now,
                totalPacketReceived = 0,
                totalPacketSent     = 0,
                isGateway           = false
            };

            this.pcs.addPcToList(pC);
            this.timer2.Interval = 5000;
            this.timer2.Start();
            this.treeGridView1.Nodes[0].Expand();
            cArp.startArpDiscovery();
        }
コード例 #2
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     cArp.startArpDiscovery();
 }