i h开发者_StackOverflow中文版ave a Wireshark captures and i wand to wite a tool how sent all the packets to spesific IP address and got an error with my Socket
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);
}
each capture contain several different protocols and i don't know what to do so i try to change the SocketType and ProtocolType options and got several different errors, i will glad if anyone will show me how to ix it.
thanks
精彩评论