1# test EPROTONOSUPPORT for splicing tcp to udp socket 2 3use strict; 4use warnings; 5use IO::Socket; 6use BSD::Socket::Splice "SO_SPLICE"; 7 8our %args = ( 9 errno => 'EPROTONOSUPPORT', 10 func => sub { 11 my $sl = IO::Socket::INET->new( 12 Proto => "tcp", 13 Listen => 5, 14 LocalAddr => "127.0.0.1", 15 ) or die "socket listen failed: $!"; 16 17 my $s = IO::Socket::INET->new( 18 Proto => "tcp", 19 PeerAddr => $sl->sockhost(), 20 PeerPort => $sl->sockport(), 21 ) or die "socket failed: $!"; 22 23 my $ss = IO::Socket::INET->new( 24 Proto => "udp", 25 ) or die "socket splice failed: $!"; 26 27 $s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', $ss->fileno())) 28 and die "splice tcp to udp socket succeeded"; 29 }, 30); 31