Raw Sockets problem.
Right, so. I wanted to learn to use Raw Sockets so I could make a class for them, yes? Well, I've hit a snag with using IP_HDRINCL with getsockopt();
By default, Raw Sockets automatically build an IP header for you, by declaring IP_HDRINCL on a handle to a raw socket descriptor, you have to make the headers for the packets that are sent through it.
This proves to be easier than I thought it would be and rather linear in reality, there is a problem however:
That code shows me error code 10022 on line 118, I looked up the error code and it is caused by an invalid parameter on line 115 AKA setsockopt(); MSDN has told me it normally has something to do with the level parameter (param 2) of setsockopt. I checked at least 5 times, I am using IPPROTO_IP, which is valid, in conjunction with IP_HDRINCL which is also valid as stated by MSDN (certain levels used in setsockopt can only set certain options on the socket, both IPPROTO_IP and IPPROTO_IPV6 can use IP_HDRINCL.)
Can anybody here help?
IPPROTO_IP Socket Options
The "Optval type" column specifies DWORD - that may be your "invalid parameter".
By default I thought that was it too, but I even went so far as to pull the code that makes the socket and sets the option out of a very good book over Network Programming on Windows.
Edit, typecasts suck.
>> ...out of a very good book...
My book says BOOL too, but you're the one getting "invalid parameter".
Are you running this code on a Win2K machine or higher?
If so, does the account running this code have Administrator privileges?