Multicast Message under kernel 2.4

Multicast Message under kernel 2.4

Post by Keith Sne » Tue, 24 Jun 2003 23:18:27



Hi,

I am having problems with the 2.4 Kernel (SuSE 8.2 and RedHat 9). The
code below sends a multicast message and works fine on RedHat 6,
RedHat 7.2, SuSE 7 and SuSE 8.0. On SuSE 8.2 and RedHat 9 it returns
the error "Network is unreachable"

Can anyone help please?

Best Regards

Keith

#include    <errno.h>
#include    <sys/types.h>
#include    <sys/socket.h>
#include    <netinet/in.h>

#define MULTICAST_ADDRESS   0xefc0409a
#define CONTROL_STARTUP    ((unsigned char)'\x15')

int main(void)
{
    int MulticastSocket = 0;
    int Port = 4950;
    unsigned char buffer[20];
    unsigned char *header = buffer;
    unsigned char *body = buffer + 16;
    size_t NumBytes = 0;
    struct sockaddr_in to;

    MulticastSocket = socket(AF_INET,SOCK_DGRAM,0);
    if (MulticastSocket < 0)
    {
        printf("ERROR: socket() returned %d,error = %s\n",
            MulticastSocket,strerror(errno));
        return;
    }

    memset(header,'\0',16);
    header[0] = CONTROL_STARTUP;
    header[10] = 0x00;
    *((uint *)body) = htonl((uint)getpid());

    /*
    ** Set up the destination address
    */
    memset(&to,'\0',sizeof(to));
    to.sin_family = AF_INET;
    to.sin_port = htons(Port);
    to.sin_addr.s_addr = htonl(MULTICAST_ADDRESS);

    errno = 0;
    NumBytes = sendto(MulticastSocket,buffer,sizeof(buffer),
        0,                      /* flags - none set */
        &to,sizeof(to));

    if ((int)NumBytes < 0)
    {
        printf("ERROR: sendto() returned %d,error = %s\n",
                NumBytes,strerror(errno));
    }

    close(MulticastSocket);

Quote:}

 
 
 

1. Multicast Message under kernel 2.4

Hi,

I am having problems with the 2.4 Kernel (SuSE 8.2 and RedHat 9). The
code below sends a multicast message and works fine on RedHat 6,
RedHat 7.2, SuSE 7 and SuSE 8.0. On SuSE 8.2 and RedHat 9 it returns
the error "Network is unreachable"

Can anyone help please?

Best Regards

Keith

#include    <errno.h>
#include    <sys/types.h>
#include    <sys/socket.h>
#include    <netinet/in.h>

#define MULTICAST_ADDRESS   0xefc0409a
#define CONTROL_STARTUP    ((unsigned char)'\x15')

int main(void)
{
    int MulticastSocket = 0;
    int Port = 4950;
    unsigned char buffer[20];
    unsigned char *header = buffer;
    unsigned char *body = buffer + 16;
    size_t NumBytes = 0;
    struct sockaddr_in to;

    MulticastSocket = socket(AF_INET,SOCK_DGRAM,0);
    if (MulticastSocket < 0)
    {
        printf("ERROR: socket() returned %d,error = %s\n",
            MulticastSocket,strerror(errno));
        return;
    }

    memset(header,'\0',16);
    header[0] = CONTROL_STARTUP;
    header[10] = 0x00;
    *((uint *)body) = htonl((uint)getpid());

    /*
    ** Set up the destination address
    */
    memset(&to,'\0',sizeof(to));
    to.sin_family = AF_INET;
    to.sin_port = htons(Port);
    to.sin_addr.s_addr = htonl(MULTICAST_ADDRESS);

    errno = 0;
    NumBytes = sendto(MulticastSocket,buffer,sizeof(buffer),
        0,                      /* flags - none set */
        &to,sizeof(to));

    if ((int)NumBytes < 0)
    {
        printf("ERROR: sendto() returned %d,error = %s\n",
                NumBytes,strerror(errno));
    }

    close(MulticastSocket);

2. Solaris CD problems: intel machine

3. 2.4 kernel messages

4. Java 2 (JDK 1.2) for AIX

5. UNZIP for UNIX

6. DNS, lame-delegation and recvfrom: errors ??

7. Why does the 2.4 kernel log messages out of order?

8. Hearing multicast in 2.6 vs. 2.4

9. Configuring Multicast routing on Linux 2.4.x

10. Multicast tunneling in 2.4

11. Linux 2.4 and Multicast Tunneling