Posted on 2008-02-07 19:57:39-08 by perldashw
How to obtain the Source IP in a multicast client

So imagine the multicast client taken directly from the IO::Socket::Multicast docs:

use IO::Socket::Multicast; my $sock = IO::Socket::Multicast->new(Proto=>'udp',LocalPort=>PORT); $sock->mcast_add(GROUP); while (1) { my $data; next unless $sock->recv($data,1024); print $data; }

How would one obtain the ip address of the machine that sent $data?

Thanks a million!

-Mike

Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.