• Welcome to Valhalla Legends Archive.
 

Question About Winsock API

Started by Dyndrilliac, December 24, 2004, 11:17 PM

Previous topic - Next topic

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.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

MyndFyre

#1
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]
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

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.

Dyndrilliac

#3
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.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.