55
66
77def main_udp (args : argparse .Namespace ) -> None :
8- coro = start_udp_client (args .host , args .port , count = args .count , payload_size = args .packetsize , wait = args .wait )
8+ coro = start_udp_client (
9+ args .host ,
10+ args .port ,
11+ count = args .count ,
12+ payload_size = args .packetsize ,
13+ wait = args .wait ,
14+ )
915 loop = asyncio .get_event_loop ()
1016 task = loop .create_task (coro )
1117 try :
@@ -23,17 +29,32 @@ def main() -> None:
2329 parser_udp_ping = subparsers .add_parser ('udp' )
2430 parser_udp_ping .add_argument ('host' )
2531 parser_udp_ping .add_argument ('port' , type = int )
26- parser_udp_ping .add_argument ('-c' , '--count' , type = int , default = - 1 ,
27- help = 'Stop after sending (and receiving) COUNT packets.'
28- ' If this option is not specified, ping will operate until interrupted.' )
29- parser_udp_ping .add_argument ('-s' , '--packetsize' , type = int , default = 48 ,
30- help = 'Specify the number of data bytes to be sent.'
31- ' The default is 48, which translates into 64 UDP data bytes when combined'
32- ' with the 16 bytes of ping header data.' )
33- parser_udp_ping .add_argument ('-i' , '--wait' , type = float , default = 1.0 ,
34- help = 'Wait WAIT seconds between sending each packet.'
35- ' The default is to wait for one second between each packet.'
36- ' The wait time may be fractional' )
32+ parser_udp_ping .add_argument (
33+ '-c' ,
34+ '--count' ,
35+ type = int ,
36+ default = - 1 ,
37+ help = 'Stop after sending (and receiving) COUNT packets.'
38+ ' If this option is not specified, ping will operate until interrupted.'
39+ )
40+ parser_udp_ping .add_argument (
41+ '-s' ,
42+ '--packetsize' ,
43+ type = int ,
44+ default = 48 ,
45+ help = 'Specify the number of data bytes to be sent.'
46+ ' The default is 48, which translates into 64 UDP data bytes when combined'
47+ ' with the 16 bytes of ping header data.'
48+ )
49+ parser_udp_ping .add_argument (
50+ '-i' ,
51+ '--wait' ,
52+ type = float ,
53+ default = 1.0 ,
54+ help = 'Wait WAIT seconds between sending each packet.'
55+ ' The default is to wait for one second between each packet.'
56+ ' The wait time may be fractional'
57+ )
3758 parser_udp_ping .set_defaults (func = main_udp )
3859
3960 args = parser .parse_args ()
0 commit comments