What difference between the raw sockets

This is a discussion on What difference between the raw sockets within the Linux Programming forums, part of the Platform Specific Boards category; I read some codes about socket in linux,I find
sometimes it creates raw socket using socket(AF_INET,SOCK_RAW,IPPROTO_RAW),
sometimes using socket(AF_INET,SOCK_RAW,IPPROTO_ICMP),
I ...

What difference between the raw sockets

I read some codes about socket in linux,I find
sometimes it creates raw socket using socket(AF_INET,SOCK_RAW,IPPROTO_RAW),
sometimes using socket(AF_INET,SOCK_RAW,IPPROTO_ICMP),
I want to know what difference between them?and what time we
creates raw socket using socket (AF_INET, SOCK_RAW, IPPROTO_RAW)?
and what time using socket (AF_INET, SOCK_RAW,IPPROTO_ICMP)?
Thank you very much.