Re: networking question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is my client:

#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
main()
{
        int s;
        int opt = 1;
        struct sockaddr_in serv;
        char *ip = "192.168.20.166";
        struct sockaddr_in m;

        s = socket(AF_INET, SOCK_DGRAM, 0);

        serv.sin_family = AF_INET;
        serv.sin_addr.s_addr = inet_addr("224.0.0.1");
        serv.sin_port = htons(1111);

        memset(&m, 0, sizeof(m));
        m.sin_addr.s_addr = inet_addr(ip);
        setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &m, sizeof(m));

        while (1) {
                sendto(s, ip, strlen(ip), 0, (struct sockaddr *)&serv,
sizeof(serv));
                sleep(1);
        }
}


I couldn't run a server this time but i captured packets on the other
host in tcpdump. I did get the 224.0.0.1 mcast packets,

is this something that the kernel always does registers by default to
the all node multicast in v4 and v6 case also?

or is my program buggy? thanks,

On Thu, Mar 14, 2013 at 2:11 PM, Rami Rosen <roszenrami@xxxxxxxxx> wrote:
> Hi,
>
> Can you post your client and server code?
>
> rgs,
> Rami Rosen
> http://ramirose.wix.com/ramirosen
>
>
> On Thu, Mar 14, 2013 at 12:55 PM, devendra.aaru <devendra.aaru@xxxxxxxxx> wrote:
>> Hey all,
>>
>> I have got a strange bug(?) while testing the multicasting server and client.
>>
>> I have done only the INADDR_ANY bind in server and client adds its
>> IP_MULTICAST_IF to 224.0.0.1 ,
>>
>> surprisingly i recvd pkts from the client with out joining using
>> IP_ADD_MEMBERSHIP.
>>
>> Is that a bug? or as we listening on INADDR_ANY will make us recv all
>> the mcast/bcast pkts?
>>
>> while if i do tx on 224.0.0.3 , the server is not able to recv the packets.
>>
>> any ideas?
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@xxxxxxxxxxxxxxxxx
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux