Valhalla Legends Forums Archive | Visual Basic Programming | Question About Winsock API

AuthorMessageTime
Dyndrilliac
How do I know what Address Family and Socket Type to use when calling Socket()? I want to create a socket for sending IGMP Packets to many different remote hosts.

I'm relatively sure I want to use AF_INET (&H2) for the Address Family and SOCK_RAW (&H3) for Socket Type. I would use AF_UNSPEC (&H0) but MSDN discouraged that.
December 25, 2004, 5:17 AM
Myndfyr
You're right about wanting to use AF_INET for Address Family, but you want to use SOCK_STREAM (1) for it.  With SOCK_RAW, you have to also create the entire TCP and IP headers on your own, and raw sockets have been removed from Windows XP SP2 to try to help eliminate malware.

[edit] Whoops, I didn't see that he said he was trying to multicast IGMP.  I thought he was looking for a standard streaming socket.  See Adron's post below. :) [/edit]
December 25, 2004, 7:11 AM
Adron
IGMP, is that for setting up multicasting? If so, I think there are other APIs that you could use rather than trying to set it up yourself.

You probably shouldn't use AF_UNSPEC unless you want to generate some kind of really strange packets. AF_UNSPEC means you don't know if you want to use IP, IPX, NetBEUI, AppleTalk, or any other protocol. Since you want to use IGMP, you do know that you want to use IP.

For your socket, I'd try AF_INET, SOCK_DGRAM and IPPROTO_IGMP.
December 25, 2004, 5:35 PM
Dyndrilliac
No, it isn't for multicasting (Not even really sure what that is).

I was pretty sure what to use but I wanted to make sure before giving it a run through. My actual intent is i'm trying to create a simple basic ip nuking type application.
December 25, 2004, 9:24 PM

Search