Multicasting problem with TCPIP 5.0 and QNX 4.25

Hello Again,
I think I posted this as a reply to another article else by mistake…
Hopefully I have it right this time.

I am having difficulty receiving multicast data using tcprt50 under
qnx425. The same identical program running under my linux box works
perfectly. For my testbed, I have two computers connected via cross-over
cable (no routers or hobs or switches to worry about). Using NetInfo, I
can see the packets being received. But I am not seeing any data being
received. I attach a hub and connect my linux box, compile the same
program and voila, packets received. The sender is sending out to
224.1.1.1 at port 1969 and I can verify this using a protocol analyzer
(ethereal) and the fact that the linux version works like a charm. What am
I doing wrong?

Help!
~Steve


-----------------------sysinit-----------------------
—cut—
Net &
Net.rtl -M &
Tcpip node1
ifconfig lo up 127.0.0.1
ifconfig en1 up 172.26.71.26 -netmask 255.255.255.0
route add default 172.26.71.1
route add -net 224.0.0.0 -netmask 240.0.0.0 172.26.71.26
mcast_rcv






-----------------------mcast_rcv.c-----------------------

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


#define FOREVER 1

/* pretty print the received message */
print_dbg(char *buffer, int count)
{
int x;
char acString[32];
int count2;

memset(acString,0,sizeof(acString));

if ((count %16) > 0)
count2 = count + (16-(count%16));

for (x=0;x<count2;x++)
{
if ((x % 16)==0) printf("%04x: “,x);
if ((x % 16)==8) printf(”- ");

if (x >= count)
{
printf(" “);
acString[(x % 16)]=’ ';
}
else
{
printf(”%02X ",(unsigned char)buffer[x]);

if (isalnum(buffer[x]))
acString[(x % 16)]=buffer[x];
else
acString[(x % 16)]=’.’;
}
if ((x % 16)==15) printf(":%16s:\n",acString);
}

printf("\n\n");
}

/* setup the socket */
int udp_initialize(char *group, int port)
{
int sockfd;
struct sockaddr_in servaddr, cliaddr;
struct ip_mreq mreq;
const int on=1;

if ((sockfd=socket(AF_INET, SOCK_DGRAM, 0))<0)
{
perror(“socket”);
exit(1);
}
memset(&servaddr,0,sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(port);

/* allow multiple instances */
setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));

if (bind(sockfd, (void *) &servaddr, sizeof(servaddr))<0)
{
perror(“bind”);
exit (1);
}

/* register for the multicast group /
mreq.imr_multiaddr.s_addr=inet_addr(group);
mreq.imr_interface.s_addr=htonl(INADDR_ANY); /
only one avail */
if (setsockopt(sockfd,IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,
sizeof(mreq))<0)
{
perror(“setsockopt (MultiCast Add)”);
exit(1);
}

return sockfd;
}


/* simple receive plugin replacement */
int udp_Receive(int dummy, unsigned char *acMessage, int iSize)
{
static int sockfd=-1;
struct sockaddr_in addr;
size_t addrlen;
char msgbuf[1500];
int ret;

if (sockfd==-1)
sockfd = udp_initialize(“224.1.1.1”, 1969);

memset(&msgbuf,0,sizeof(msgbuf));
addrlen=sizeof(addr);

if ((ret=recvfrom(sockfd,(void *)&msgbuf,sizeof(msgbuf),0,
(void )&addr, &addrlen))<0)
{
if (errno!=EINTR) /
if not interrupted from the timer */
{
perror(“recvfrom”);
exit(1);
}
}
else
memcpy(acMessage,msgbuf,iSize);

return (ret);
}

main()
{
int ret;
char Message[1500];

memset(&Message,0,sizeof(Message));

while (FOREVER)
{
if ((ret=udp_Receive(0,(char *)&Message,sizeof(Message)))>0)
print_dbg(Message,ret);
}
}

Yet again, Hello,

Upon further investigation, I believe my problem is the Net.rtl driver
not operating properly with Multicast Packets. I have the version 4.25C
Dated Jan 9 2001. Net is version 4.25C Dated Aug 30 1999. Does anyone
know what the latest version are and where I can get them?

~Steve



Steven Carr wrote:

Hello Again,
I think I posted this as a reply to another article else by mistake…
Hopefully I have it right this time.

I am having difficulty receiving multicast data using tcprt50 under
qnx425. The same identical program running under my linux box works
perfectly. For my testbed, I have two computers connected via cross-over
cable (no routers or hobs or switches to worry about). Using NetInfo, I
can see the packets being received. But I am not seeing any data being
received. I attach a hub and connect my linux box, compile the same
program and voila, packets received. The sender is sending out to
224.1.1.1 at port 1969 and I can verify this using a protocol analyzer
(ethereal) and the fact that the linux version works like a charm. What
am I doing wrong?

Help!
~Steve


-----------------------sysinit-----------------------
—cut—
Net &
Net.rtl -M &
Tcpip node1
ifconfig lo up 127.0.0.1
ifconfig en1 up 172.26.71.26 -netmask 255.255.255.0
route add default 172.26.71.1
route add -net 224.0.0.0 -netmask 240.0.0.0 172.26.71.26
mcast_rcv