#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
#define TEST_PORT 12345
#define SEND_PORT 12345
#define BUFSIZE 512
#define USAGE_STMT "Usage: argv[0] <address> <message>\n"
int main(int argc, char* argv[])
{
int i, s, duh;
struct sockaddr_in saddr;
char buf[BUFSIZE];
if (argc != 3)
{
printf(USAGE_STMT);
return -1;
}
s = socket(PF_INET, SOCK_DGRAM, 0);
if (s == -1)
{
printf("argv[0]: cannot get socket descriptor\n");
return -1;
}
saddr.sin_family = AF_INET;
saddr.sin_port = htons(SEND_PORT);
saddr.sin_addr.s_addr = INADDR_ANY;
/*if (bind(s, &saddr, sizeof(struct sockaddr_in)) == -1)
{
printf("argv[0]: could not name socket\n");
return -1;
}*/
saddr.sin_port = htons(TEST_PORT);
saddr.sin_addr.s_addr = inet_addr(argv[1]);
strcpy(buf, argv[2]);
duh = sizeof(struct sockaddr_in);
sendto(s, buf, strlen(buf)+1, 0, &saddr, duh);
}
On Thu, Dec 07, 2000 at 05:34:44AM -0800, Daniel Chemko wrote:
> Hello,
> I am doing development work on the 2.4.0 kernel, and can not seem to get
> multicasting to work.
I frequently experiment with "zebra" (http://www.zebra.org) routing engine
and multicasting works for me (2.4.0-test11), according to tcpdump and
observed behavior.
If you have multiple interfaces with the same IP address (point-to-point
interfaces: same local address) then it is possible that the packets go
out via the wrong interface. This has bitten me once.
--
Frank