这是我的监控HTTP代码:HTTP监视器在C#
static void Main(string[] args)
{
try
{
byte[] input = BitConverter.GetBytes(1);
byte[] buffer = new byte[4096];
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
s.Bind(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 80));
s.IOControl(IOControlCode.ReceiveAll, input, null);
s.BeginReceive(arrResponseBytes, 0, arrResponseBytes.Length, SocketFlags.None, new AsyncCallback(OnClientReceive), s);
System.Threading.ManualResetEvent reset = new System.Threading.ManualResetEvent(false);
reset.WaitOne();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
Console.ReadKey();
}
static byte[] arrResponseBytes = new byte[1024 * 5];
protected static void OnClientReceive(IAsyncResult ar)
{
Socket socket = (Socket)ar.AsyncState;
int count = socket.EndReceive(ar);
if (count > 0)
{
Console.WriteLine(Encoding.ASCII.GetString(arrResponseBytes, 0, count));
socket.BeginReceive(arrResponseBytes, 0, arrResponseBytes.Length, SocketFlags.None, new AsyncCallback(OnClientReceive), socket);
}
}
,但我不能让HTTP主机。 我不知道什么数据。 我想获取http主机,例如: http://google.com 我该如何监控系统http? 谢谢。
这是我的数据是:http://hamishebaharp30world.persiangig.com/Pics/Use/http%20monitoring .jpg – 2012-07-09 09:29:17
你试过解压吗?可以在服务器端进行压缩(通过头文件告知),然后你会看到垃圾。无论如何,我不确定您是否可以区分不同的请求,但正如我所说,我不确定这是否会成为问题。 – Sascha 2012-07-09 09:57:43
你是如何摆弄软件的?我想让浏览器成为事实。 – 2012-07-09 10:42:10