Multicast Message under kernel 2.4

Multicast Message under kernel 2.4

Post by Keith Sne » Fri, 20 Jun 2003 00:21:00



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:}

 
 
 

Multicast Message under kernel 2.4

Post by Gary Gapinsk » Fri, 20 Jun 2003 01:45:55



> 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"

It works OK for me on SuSE 8.2 2.4.20-4GB.

I don't recall making any unusual configuration changes.

 
 
 

Multicast Message under kernel 2.4

Post by Keith Sne » Fri, 20 Jun 2003 20:21:27



> It works OK for me on SuSE 8.2 2.4.20-4GB.

> I don't recall making any unusual configuration changes.

Even stranger!!!!!!!

I will have a look at my configuration.

Thanks for trying it.

Keith

 
 
 

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. Problems with 'timed'

3. 2.4 kernel messages

4. Boot problem - invalid compressed format (err=1)

5. new G4 and LinuxPPC1999--no go?

6. Is Swapping on software RAID1 possible in linux 2.4 ?

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