C# 4.0 正在尝试发送Wireshark捕获数据包

C# 4.0 正在尝试发送Wireshark捕获数据包,c#-4.0,C# 4.0,我有一个Wireshark捕获,我想知道一个工具是如何将所有数据包发送到spesific IP地址的,但我的套接字出现了错误 string snoopFileName = "capture.snoop"; FileInfo fileInfo = new FileInfo(snoopFileName); long FileSize = fileInfo.Length; FileStream fileStream = new File

我有一个Wireshark捕获,我想知道一个工具是如何将所有数据包发送到spesific 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);    
        }
string snoopFileName=“capture.snoop”;
FileInfo FileInfo=新的FileInfo(snoopFileName);
long FileSize=fileInfo.Length;
FileStream FileStream=新FileStream(snoopFileName,FileMode.Open,FileAccess.Read);
BinaryReader=新的BinaryReader(文件流);
字节[]缓冲区=新字节[文件大小];
int nReadCount=reader.Read(缓冲区,0,(int)文件大小);
字符串地址=“157.55.85.212”;
int端口=80;
IPEndPoint ep=新IPEndPoint(IPAddress.Parse(地址),端口);
Socket client=新套接字(AddressFamily.InterNetwork,SocketType.Raw,ProtocolType.IP);
对于(int i=0;i
每个捕获都包含几个不同的协议,我不知道该怎么做,所以我尝试更改SocketType和ProtocolType选项,但出现了几个不同的错误,如果有人告诉我如何使用ix,我会很高兴


谢谢

您遇到了什么错误?因为我不知道用SocketType和ProtocolType写什么,我尝试了所有选项,收到了:1。试图以其访问权限2所禁止的方式访问套接字。在数据报套接字上发送的消息大于内部消息缓冲区或某些其他网络限制,或者用于接收数据报的缓冲区小于数据报本身