Hi,
I am having problems sending a MULTICAST packet to another machine.
When I try to send the packet, I receive:
sendto error: 251 (Network unreachable).
The sender is a Qnx machine (code segment follows) and the receiver
of the MULTICAST is an NT machine. The program has no problem
sending and receiving unicasts.
Is there any particular action I need to take before sending
a unicast? (setsockopt()??)
Thank you very much.
\
struct sockaddr_in cmd_addr;
struct sockaddr_in data_addr;
sockCmd = socket(AF_INET, SOCK_DGRAM, 0 );
if ( -1 == sockCmd ) …
sockData = socket(AF_INET, SOCK_DGRAM, 0 );
if ( -1 == sockData ) …
bzero(( char * )&cmd_addr, sizeof( cmd_addr ));
cmd_addr.sin_family = AF_INET;
cmd_addr.sin_addr.s_addr = inet_addr( “195.0.0.1” );
cmd_addr.sin_port = htons( CMD_PORT );
bzero(( char * )&data_addr, sizeof( data_addr ));
data_addr.sin_family = AF_INET;
data_addr.sin_addr.s_addr = inet_addr( “195.0.0.1” );
data_addr.sin_port = htons( DATA_PORT );
status = bind( sockCmd, ( struct sockaddr * )&cmd_addr,
sizeof( cmd_addr ));
if ( -1 == status ) …
status = bind( sockData, ( struct sockaddr * )&data_addr,
izeof( data_addr ));
if ( -1 == status ) …
t=1;
ioctl(sockCmd, FIONBIO, &t); // make them non-blocking
ioctl(sockData, FIONBIO, &t);
struct sockaddr_in their_addr;
int status;
bzero(( char * )&their_addr, sizeof( their_addr ));
their_addr.sin_family = AF_INET;
their_addr.sin_addr.s_addr = IP_addr; file://239.1.2.11 <
their_addr.sin_port = htons( port );
status = sendto( wsocket,
buf,
numchar,
0,
(struct sockaddr *)&their_addr,
sizeof( their_addr ));
if ( -1 == status ) …