1/*
2 * Copyright 2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *      Hugo Santos, hugosantos@gmail.com
7 */
8
9#include <string.h>
10
11#include <arpa/inet.h>
12#include <netinet/in.h>
13#include <sys/socket.h>
14
15int main(int argc, char *argv[])
16{
17	char buf[256];
18
19	int sock = socket(AF_INET, SOCK_DGRAM, 0);
20
21	sockaddr_in sin;
22	memset(&sin, 0, sizeof(sin));
23	sin.sin_family = AF_INET;
24	sin.sin_port = htons(12345);
25
26	bind(sock, (sockaddr *)&sin, sizeof(sin));
27
28	ip_mreq mreq;
29	memset(&mreq, 0, sizeof(mreq));
30
31	inet_pton(AF_INET, argv[1], &mreq.imr_multiaddr);
32
33	setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
34
35	while (1) {
36		int len = recv(sock, buf, sizeof(buf), 0);
37	}
38
39	return 0;
40}
41
42