CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: IP MULTICAST

  1. #1
    Join Date
    Apr 1999
    Posts
    11

    IP MULTICAST

    Hello,

    I guess i don't have sufficient informations on how to use ip multicast services.
    My API refuse to add me to a multicast group. It fails in the code sample provided below:


    memset( &LocalAddr, 0x00, sizeof(LocalAddr));
    LocalAddr.sin_family = AF_INET;
    LocalAddr.sin_addr.s_addr = inet_addr("192.168.0.1"); //my local machine address
    LocalAddr.sin_port = usPort;

    err = bind( UDP_Soc, (struct sockaddr *)&LocalAddr, sizeof(LocalAddr));

    if (err == SOCKET_ERROR)
    return ER_SOCK_BIND;

    mreq.imr_multiaddr.s_addr = inet_addr( "233.1.1.1" ); //arbitaral mcast addr
    mreq.imr_interface.s_addr = inet_addr( "192.168.0.1" );

    if (setsockopt(UDP_Soc, IPPROTO_IP, IP_ADD_MEMBERSHIP,
    (char*)&mreq, sizeof(struct ip_mreq)) == SOCKET_ERROR )
    return ER_SOCK_BIND; //FAILS HERE!!




    This code sample is taken from the tutorials and should work.
    My system:
    WinNT 4.0
    two network interfaces (proxy server SyGate joining LAN with Inet)
    TCP/IP installed (this post is a proove)
    i dont have any problems with unicast - works both outside and inside my LAN.

    please help.
    it sais WinNT is multicast compliant.
    where do i fail?

    thanks in advance
    Rem


  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Re: IP MULTICAST

    Maybe one more thing that i've forgot:
    setsockopt() returns:
    /
    WSAENOPROTOOPT The option is unknown or unsupported for the specified provider or socket (see SO_GROUP_PRIORITY limitations).
    /

    Should i ask my Inet provider on that?
    Can i become a router for the IGMP msgs in my LAN?
    How do i know if the setsockopt() failure is the network interface fault rather than my code's.

    thanks again



  3. #3
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    38

    Start multicast socket

    Hopefully you started your socket with the Datagram option other wise the errormessage is correct. For there is no multicasting under tcp.
    Not under NT at least as far as I know.

  4. #4
    Join Date
    Apr 2001
    Posts
    514
    Hi,

    I'm not sure what is causing your error, but I have a couple of projects which illustrate the required steps for creating a multicast server and the client. I can't remember where I got them and there's no details of the author on the files so use them however you see fit


    Lee.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured