I’m using Tamir’s SharpPCap to try to send data to my msn.
Currently, for testing purposes, my idea is to wait for any msg received by mymsn@msn.com and then send the packet itself again, that is, make any message appear repeated forever on my msn. I thought this had to work, as I am simply getting the packet itself I receive, and resending it again.
For some reason nothing appears on my msn, although I will see printed in the console a lot of “caught data, resending it”. Any ideas? Thanks
class Program {
static PcapDevice device;
static void Main(string[] args) {
device = SharpPcap.GetAllDevices()[0];
device.PcapOnPacketArrival +=
new SharpPcap.PacketArrivalEvent(device_PcapOnPacketArrival2);
device.PcapOpen(true, 1000);
device.PcapStartCapture();
Console.ReadKey();
}
static void device_PcapOnPacketArrival2(object sender, Packet packet) {
TCPPacket tcpPacket = packet as TCPPacket;
if (tcpPacket == null) {
return;
}
string data = Encoding.Default.GetString(tcpPacket.Data);
if (!data.StartsWith("MSG mymsn@msn.com")) {
return;
}
Console.WriteLine("caught data, resending it");
device.PcapSendPacket(tcpPacket);
}
}
One key feature of TCP is “discarding duplicate packets”
So to solve your problem with WinPcap you’ll have to capture of all packets of one MSN message and resend it in new packets. Hopefully MSN won’t accept that.
In that case learning how to deal with the MSN protocol could bring a solution to this problem.
CodeProject Howto: Connect_To_MSN_Messenger
Maybe this C# lib MSNP-Sharp somehow solves your problem or at least gives you a better understanding of Microsoft Notification Protocol