• Re: Multicast in VxWorks

    From Address M@21:1/5 to Bob DeJoie on Sun Dec 18 22:05:49 2022
    On Tuesday, June 20, 2000 at 12:30:00 PM UTC+5:30, Bob DeJoie wrote:
    On Mon, 19 Jun 2000 15:57:58 GMT, "Øyvind Holmeide" <oeyvind.holmeide@no.abb.com> wrote:


    I am trying to use UDP multicast in VxWorks without success. I have used >the sample code from WindRiver, see below, but the sendto() command fails >with errno = 0x41. Any hints?

    <snip>
    /* sin.sa_len = (u_char) sizeof(sin); */
    sin.sin_family = AF_INET;
    sin.sin_addr.s_addr = INADDR_ANY;
    sin.sin_port = htons(0);

    if (bind(sockDesc, (struct sockaddr *)&sin, sizeof(sin)) != 0)


    perror("bind");
    if (sockDesc)
    close (sockDesc);
    return (ERROR);
    }

    At this point in my initialization I configure the interface for
    multicast, with somethin like :
    setsockopt(send_socket,
    IPPROTO_IP,
    IP_MULTICAST_IF,
    (char *)&sin.sin_addr.s_addr,
    sizeof(sin.sin_addr.s_addr));
    Then set TTL if there are any routers in that the message must
    go through.
    I am using 5.3.1 with the SENS and SENS upgrade patches applied.
    toAddrLen = sizeof(struct sockaddr_in);
    /* toAddr.sa_len = (u_char) toAddrLen; */
    toAddr.sin_family = AF_INET;


    /* initialize the address to the send */
    toAddr.sin_addr.s_addr = inet_addr (mcastAddr);

    /* initialize the port to send */
    toAddr.sin_port = htons(mcastPort);

    bufPtr = sendBuf; /* initialize the buffer pointer */

    /* send the buffer */
    while (sendLen > 0)


    if ((len = sendto (sockDesc, bufPtr, sendLen, 0,
    (struct sockaddr *)&toAddr, toAddrLen)) < 0 )


    printf("mcastSend sendto errno:0x%x\n", errno );
    break;
    }

    sendLen -= len;
    bufPtr += len;

    taskDelay (1); /* give a taskDelay */
    }

    if (sockDesc != ERROR)
    close (sockDesc);

    return (OK);
    }



    ================================================
    Bob DeJoie
    Kwajalein Missile Range
    Republic of the Marshall Islands
    email: rjdejoie@kmrmail.kmr.ll.mit.edu
    phone: 805-355-5855 fax: 805-355-3833
    Time Zone: GMT +12 hours ================================================
    Dear All,

    Can someone provide working code for Multicast receiver and sender for Vxworks 6.5.3 and 6.9
    I am unable to receive the multicast response after binding.
    After so many failed attempts unable to receive the data.

    Current code link "https://pastebin.com/embed_js/KTn17YG2"
    This code is working in ubuntu, but in vxworks after binding not able to receive packets.
    Do I need to configure in L3 switch?

    Thanks...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)