I need to create TCP/IP headers manually for my application. For that i used Raw socket. My system os is win xp (SP3).
My code compiles fine 🙂 but it throws a run time error:
Initialising Winsock...Initialised successfully. Creating Raw TCP Socket...Raw TCP Socket Created successfully. Setting the socket in RAW mode...Successful. Enter hostname : 192.168.1.152 Resolving Hostname...Resolved. Enter Source IP : 192.168.1.151 Sending packet... Error sending Packet : 10022
I have set IP_HDRINCL to 1. What am i doing wrong? I switched off the firewall too but still get the same result.
I suggest using WinPcap for this purpose. Even when you figure out how to do this properly with the win32 API it is going to be horribly slow.
I’ve used WinPcap successfully to inject packets to a Gigabit ethernet port as fast as the hardware can handle.