/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cCustomToolbar_OnPauseResumeSelected(object sender, EventArgs e) { if (cCustomToolbar.cCustomComboBox.ComboText.Length > 0) { ManageStateIcons(); /* Arrancamos o pausamos la traza según sea el caso */ if (m_tracestate) { if (m_rawsocket == null) { m_rawsocket = new CRawSocket(cCustomToolbar.cCustomComboBox.ComboText, 0); m_rawsocket.OnPacketReceived += new Sniffer.CRawSocket.PacketReceivedHandler(m_rawsocket_OnPacketReceived); m_rawsocket.OnStartSniffing += new Sniffer.CRawSocket.SocketHandler(m_rawsocket_OnStartSniffing); m_rawsocket.OnStopSniffing += new Sniffer.CRawSocket.SocketHandler(m_rawsocket_OnStopSniffing); cCustomToolbar.cCustomComboBox.ComboEnabled = false; tmrRefresh.Enabled = true; } m_rawsocket.IsListening = true; } else { if (m_rawsocket != null) { m_rawsocket.IsListening = false; } } } else { MessageBox.Show(CShare.ADAPTERNOTSELECTED, CShare.EXCLAMATIONMSG, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
static void Main(string[] args) { CRawSocket x = new CRawSocket("192.168.37.140", 0); x.OnPacketReceived += new Sniffer.CCommon.PacketReceivedHandler(x_OnPacketReceived); x.IsListening = true; }