I want to receive raw packet data from a client, and I read this message:C # Receiving packet databut I cannot understand this line:
s.Bind(new IPEndPoint(IPAddress.Parse(strIP), 80)); log(System.Text.Encoding.ASCII.GetString(buffer, 0, bytes));
strIP
log
strIP is a variable that contains the IP address of the endpoint.
The line log()should write a line version of what is received - perhaps in a log file somewhere that was previously defined in the code.
log()
strIP = Net.Dns.GetHostEntry(Net.Dns.GetHostName()).AddressList[0].ToString();
To get the local IP address.
And it log()should look like this.
private void log(string log) { Console.WritelLine(log); //or append this text in any text file }
I suggest using the pcapDotNet library in C #. https://pcapdotnet.codeplex.com/