I'd like to send IPv4 Packet using following socket in my win32 application.
socket(AF_INET, SOCK_RAW, IPPROTO_IPV6);
The above socket() returns NO error. But sebsquent socket functions such as
bind(), connect(), sendto() do NOT operate correctly.
For checking of my fault, I've tried using IPPROTO_ICMP instead of
IPPROTO_IPV6. Then bind(), connect() and sendto() functions work correctly.
One more check, I've tried like below :
socket(AF_INET, SOCK_RAW, 0);
setsockopt(sockhd, IPPROTO_IP, IP_HDRINCL, optVal, &optLen);
... build IPv4 header
... then, sendto();
But, The windows converts Protocol field of sending packet to the value
'0x0', although I set the value to IPPROTO_IPV6(41).
Why can I use SOCK_RAW with IPPROTO_IPV6 ?
Could anyone tell me why I can't or how I can ?
Thanks in advance.
"Seong Moon" <Seon...@discussions.microsoft.com> wrote in message
news:140431A2-BCF4-4926...@microsoft.com...
The last 'protocol' parameter just means that I want to set the Protocol
field of IP version 4 header to IPPROTO_IPV6(41) value.
If I want to build IP version 6 Packet, I would call socket() with AF_INET6.
BUT, In this situation I'd like to build IP version 4 Packet.
Thanks in anyway.
Arkady
"Seong Moon" <Seon...@discussions.microsoft.com> wrote in message
news:8857BCD1-D98B-448B...@microsoft.com...