Closed Thread
Results 1 to 2 of 2

Thread: Join multicast group

  1. #1
    chiyuwang is offline Newbie
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Join multicast group

    I am a newbie in socket programming, and wrote a code snipet recently to join a multicast group. But it does not work. setsockopt always return -1. Anyone can help me, thank you in advance.


    SOCKET sock;
    sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (INVALID_SOCKET == sock )
    return;

    struct ip_mreq mreq;
    sockaddr_in addrto;
    memset(&addrto,0,sizeof(addrto));
    addrto.sin_family = AF_INET;
    addrto.sin_addr.s_addr = inet_addr("224.1.2.4");
    addrto.sin_port = htons(6003);



    mreq.imr_multiaddr = addrto.sin_addr;
    mreq.imr_interface.s_addr = INADDR_ANY;
    int e = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq));

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Ewe Loon's Avatar
    Ewe Loon is offline Learning Programmer
    Join Date
    Feb 2010
    Posts
    49
    Rep Power
    0

    Re: Join multicast group

    most ISP's block Multicasting, contact your isp and ask if they do ,

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Join the .NET group!
    By cdg10620 in forum ASP, ASP.NET and Coldfusion
    Replies: 5
    Last Post: 04-06-2010, 09:41 AM
  2. join?
    By techker in forum PHP Development
    Replies: 3
    Last Post: 06-09-2009, 05:17 PM
  3. Hi nice to join
    By cakka in forum Introductions
    Replies: 3
    Last Post: 02-13-2009, 10:36 AM
  4. Receiving an IPv6 Multicast Message
    By feno in forum C# Programming
    Replies: 0
    Last Post: 01-23-2009, 09:42 AM
  5. Just join
    By ooisootuck in forum Introductions
    Replies: 8
    Last Post: 11-07-2008, 05:03 AM

Tags for this Thread

Bookmarks

Posting Permissions

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