我試過Net :: RawIP和Net :: Write :: Layer3。它工作正常,如果我在網絡中提供一個特定的IP地址。而我得到任何如何使用Perl發送IP廣播消息
sendto() at /usr/lib/perl5/Net/RawIP.pm line 630. shell returned 13
或
Net::Write::Layer::send: Permission denied
如果我改變的目的地址66.66.66.255
什麼想法?
我使用的代碼是在這裏
use Net::Write::Layer qw(:constants);
use Net::Write::Layer3;
use NetAddr::IP;
use Net::RawIP;
$message = "Foo";
# using Net::RawIP
$n = Net::RawIP->new({
ip => {
tos => 0xC0,
daddr => '66.66.66.2',
protocol => 2,
},
generic => {
data => $message
}
});
$n->send;
# using Net::Write::Layer3
my $desc = Net::Write::Layer3->new(
dst => '66.66.66.2',
protocol => '2',
family => NW_AF_INET,
);
$desc->open;
$desc->send($message);
$desc->close;
如果你在做IGMP,在'IO :: Socket :: Multicast' –