试图发送Wireshark捕获数据包

时间:2011-10-04 18:06:55

标签: c#-4.0

我有一个Wireshark捕获和我想要一个工具如何将所有数据包发送到特定IP地址并且我的套接字出错了

        string snoopFileName = "capture.snoop";

        FileInfo fileInfo = new FileInfo(snoopFileName);
        long FileSize = fileInfo.Length;
        FileStream fileStream = new FileStream(snoopFileName, FileMode.Open, FileAccess.Read);
        BinaryReader reader = new BinaryReader(fileStream);
        byte[] buffer = new byte[FileSize];
        int nReadCount = reader.Read(buffer, 0, (int)FileSize);

        string Address = "157.55.85.212";
        int Port = 80;
        IPEndPoint ep = new IPEndPoint(IPAddress.Parse(Address), Port);
        Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);            

        for (int i = 0; i < FileSize; i++)
        {
            client.SendTo(buffer, ep);    
        }

每个捕获包含几个不同的协议,我不知道该怎么做,所以我尝试更改SocketType和ProtocolType选项并得到几个不同的错误,我很高兴有人会告诉我如何使用它。

感谢

0 个答案:

没有答案