leafkda.blogg.se

Ip sniffer
Ip sniffer










ip sniffer

After setting the proper options for the socket, we then call the IOControl method on it. MainSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None,įor capturing the packets, we use a raw socket and bind it to the IP address. Start receiving the packets asynchronously MainSocket.IOControl(IOControlCode.ReceiveAll, // SIO_RCVALL of Winsock

ip sniffer

Socket.IOControl is analogous to the WSAIoctl method of Winsock 2 SocketOptionName.HeaderIncluded, // Set the include header true) // option to true MainSocket.SetSocketOption(SocketOptionLevel.IP, // Applies only to IP packets MainSocket.Bind(newIPEndPoint(IPAddress.Parse(cmbInterfaces.Text), 0))

ip sniffer

Bind the socket to the selected IP address MainSocket = newSocket(AddressFamily.InterNetwork, SocketType.Raw, 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












Ip sniffer