hithim has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone tell me how i can use recvmmsg in perl , maybe some advices how to make it work through syscall() function. I try to use it like this:
#!/usr/bin/perl use strict; use Socket; use Data::Dumper; require("syscall.ph"); my $srv; socket($srv, PF_INET, SOCK_DGRAM, getprotobyname('udp')); bind ($srv, sockaddr_in('777', INADDR_ANY)) or die $!; my $msg = "\0" x 1500; syscall(&SYS_recvmmsg, $srv, $msg, 1500,0,0) == 0 or die $!; print Dumper $msg;
But get an error : Bad file descriptor at ./syscall_test2 line 12.

Replies are listed 'Best First'.
Re: perl recvmmsg syscall
by Anonymous Monk on Apr 24, 2013 at 09:30 UTC
Re: perl recvmmsg syscall
by Anonymous Monk on Apr 24, 2013 at 09:32 UTC
    also, syscalls shows fileno(STDOUT) so try fileno($srv)
      Change to syscall(&SYS_recvmmsg, fileno($srv), $msg, 1500,0,0); Now it block untill i send some packets and then i get "Illegal seek" error.
        What does this return?
        use Data::Dump qw/ dd pp /; $!=0; my $ret = syscall(&SYS_recvmmsg, fileno($srv), $msg, 1500,0,0); dd [ int($!)." $!", $ret ];