locked
IN_MULTICAST RRS feed

  • Question

  • Hi,

    In Desktop applications you can use IN_MULTICAST macro defined in winsock.h, with IN_ADDR to determine if an address is a multicast address

    bool isMulticast(const IN_ADDR& addr)
    {
        return IN_MULTICAST(ntohl(addr.s_addr));
    }

    How can i do the same in a Metro application? i don't see a way to do the same using Windows::Networking::Hostname.

    Any ideas?

    Regards,

    Jose

    Wednesday, May 16, 2012 7:41 PM

Answers

  • The Runtime networking stack is moving away from explicit IP address -- for example, your local IP address is considered to be a "HostName", and there aren't any type of IP address classes (e..g, no IN_ADDR or SOCKADDR or anything similar). 

    Consequently, we have no equivilent of the IN_MULTICAST macro.


    Network Developer Experience Team (Microsoft)

    • Marked as answer by pepone.onrez Friday, May 18, 2012 8:42 PM
    Friday, May 18, 2012 8:05 PM

All replies

  • I did not find out the  IN_MULTICAST in Winsock.h or Winsock2.h.

    Is it in third party library?


    NEU_ShieldEdge

    Thursday, May 17, 2012 7:54 AM
  • That is not in a third party library, is part of Windows SDK

    C:\Program Files\Windows Kits\8.0\Include\shared\ws2def.h included by

    C:\Program Files\Windows Kits\8.0\Include\um\WinSock2.h

    #define IN_MULTICAST(i)         IN_CLASSD(i)
    
    
    In previous versions of Winksock.h that definition was there. http://research.microsoft.com/en-us/um/redmond/projects/invisible/include/winsock.h.htm

    Thursday, May 17, 2012 3:26 PM
  • The Runtime networking stack is moving away from explicit IP address -- for example, your local IP address is considered to be a "HostName", and there aren't any type of IP address classes (e..g, no IN_ADDR or SOCKADDR or anything similar). 

    Consequently, we have no equivilent of the IN_MULTICAST macro.


    Network Developer Experience Team (Microsoft)

    • Marked as answer by pepone.onrez Friday, May 18, 2012 8:42 PM
    Friday, May 18, 2012 8:05 PM
  • I see, i my library i have resort to some string comparisons to solve that, it works, but will be easier if WinRT provide some kind of replacement for IN_MULTICAST.

    //
    // Return true if the hostname represent an IPv multicast
    // address.
    //
    bool isMuticast(HostName^);

    In my case that is needed because, when the user enter a multicast address the lib must call JoinMulticastGroup, otherwise it just use ConnectAsync to send data to this UDP endpoint.

    For IPv4 i check first octet is between 233 and 239, for IPv6 the address start with FF, http://en.wikipedia.org/wiki/Multicast_address, easy to implement using string comparisons

    Thanks for taking the time to look at this.

    Regars,

    Jose

    Friday, May 18, 2012 8:42 PM