s***@etri.re.kr
2007-05-09 04:58:00 UTC
Hello ! There.
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.
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.