NAME
Net::Write::Fast - create and inject packets fast
SYNOPSIS
use Net::Write::Fast;
# Sends multiple TCP SYNs to multiple IPv4 targets
my $r = Net::Write::Fast::l4_send_tcp_syn_multi(
"127.0.0.1", # IPv4 source
[ '127.0.0.2', '127.0.0.3' ], # IPv4 targets
[ 25, 80, 110 ], # TCP port targets
200, # Number of packet per second
3, # Number of try
0, # Use IPv6
0, # OPTIONAL: enable warnings flag
);
# Sends multiple TCP SYNs to multiple IPv6 targets
my $r = Net::Write::Fast::l4_send_tcp_syn_multi(
"::1", # IPv6 source
[ '::2', '::3' ], # IPv6 targets
[ 25, 80, 110 ], # TCP port targets
200, # Number of packet per second
3, # Number of try
1, # Use IPv6
0, # OPTIONAL: enable warnings flag
);
# Handle errors
if ($r == 0) {
print STDERR "ERROR: ",Net::Write::Fast::nwf_geterror(),"\n";
}
DESCRIPTION
Sends network frames fast to the network.
ENOBUFS ERRORS
If you got some ENOBUFS errors, you will have to tune your Operating System TCP/IP stack. For Linux, you can increase buffer size using the following commands:
# Should be ressonable to send at 10_000 pps
sysctl -w net.core.wmem_max=109051904 # 100 MB
sysctl -w net.core.wmem_default=109051904 # 100 MB
FUNCTIONS
- l4_send_tcp_syn_multi (ip_src, ip_dst arrayref, ip_dst count, ports arrayref, ports count, packets per second, try count, use IPv6 flag)
-
Sends multiple TCP SYNs at layer 4 to multiple IP targets. Returns 0 in case of failure, and sets error buffer to an error message.
- nwf_geterror
-
Get latest error message.
- estimate_runtime { ports => ARRAYREF, targets => ARRAYREF, pps => COUNT, try => COUNT }
-
Returns a HASHREF with days, hours, minutes and seconds for estimated running time.
- runtime_as_string { days => COUNT, hours => COUNT, minutes => COUNT, seconds => COUNT }
-
Returns as string by takink the HASHREF obtained from estimate_runtime().
AUTHOR
Patrice <GomoR> Auffret
COPYRIGHT AND LICENSE
Copyright (c) 2011-2015, Patrice <GomoR> Auffret
You may distribute this module under the terms of the Artistic license. See LICENSE.Artistic file in the source distribution archive.