public AudysseyMultEQTcpSniffer(AudysseyMultEQAvr AudysseyMultEQAvr, string HostAddress, string ClientAddress) { audysseyMultEQAvr = AudysseyMultEQAvr; TcpHost = new TcpIP(HostAddress, 0, 0); TcpClient = new TcpIP(ClientAddress, 1256, 0); //For sniffing the socket to capture the packets has to be a raw socket, with the //address family being of type internetwork, and protocol being IP try { mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP); mainSocket.ReceiveBufferSize = 32768; //Bind the socket to the selected IP address IPAddress.Parse("192.168.50.66") mainSocket.Bind(new IPEndPoint(IPAddress.Parse(TcpHost.Address), TcpHost.Port)); //Set the socket options mainSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, true); mainSocket.IOControl(IOControlCode.ReceiveAll, new byte[] { (byte)ReceiveAll.RCVALL_ON, 0, 0, 0 }, new byte[] { (byte)ReceiveAll.RCVALL_ON, 0, 0, 0 }); //Start receiving the packets asynchronously mainSocket.BeginReceive(packetData, 0, packetData.Length, SocketFlags.None, new AsyncCallback(OnReceive), null); } catch (ObjectDisposedException) { } catch (Exception ex) { MessageBox.Show(ex.Message, "AudysseyMultEQTcpSniffer::TcpSniffer", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public RatbuddysseyHome() { InitializeComponent(); channelsView.SelectionChanged += ChannelsView_SelectionChanged; plot.PreviewMouseWheel += Plot_PreviewMouseWheel; System.Net.IPHostEntry HostEntry = System.Net.Dns.GetHostEntry((System.Net.Dns.GetHostName())); if (HostEntry.AddressList.Length > 0) { foreach (System.Net.IPAddress ip in HostEntry.AddressList) { cmbInterfaceHost.Items.Add(ip.ToString()); } cmbInterfaceHost.SelectedIndex = cmbInterfaceHost.Items.Count - 1; } if (File.Exists(Environment.CurrentDirectory + "\\" + TcpClientFileName)) { String ClientTcpIPFile = File.ReadAllText(Environment.CurrentDirectory + "\\" + TcpClientFileName); if (ClientTcpIPFile.Length > 0) { TcpIP TcpClient = JsonConvert.DeserializeObject <TcpIP>(ClientTcpIPFile, new JsonSerializerSettings { }); cmbInterfaceClient.Items.Add(TcpClient.Address.ToString()); cmbInterfaceClient.SelectedIndex = cmbInterfaceClient.Items.Count - 1; } } for (int x = 0; x < 61; x++) { var fcentre = Math.Pow(10.0, 3.0) * Math.Pow(2.0, ((float)x - 34.0) / 6.0); Console.Write(x); Console.Write(" "); Console.WriteLine("{0:N1}", fcentre); } }
public AudysseyMultEQAvrTcp(AudysseyMultEQAvr audysseyMultEQAvr, string ClientAddress) { _audysseyMultEQAvr = audysseyMultEQAvr; TcpClient = new TcpIP(ClientAddress, 1256, 5000); }