?? udpliteclient.pl
字號:
#!/usr/bin/perl# A simple Perl UDP-Lite client which connects to the IP address # given on the commandline, using the fixed port `$PORTNO'. # Terminate via CTRL-D.use Socket;$PORTNO = 2000; # fixed port number to connect to $cscov = 8; # checksum coverage (default header)die "usage: $0 <server-IP>\n" unless @ARGV;$ipaddr = inet_aton($ARGV[0]);$portaddr = sockaddr_in($PORTNO, $ipaddr);$proto = getprotobyname("udplite") || 136;socket(SOCKET, PF_INET, SOCK_DGRAM, $proto) or die "socket: $!";# since it is unlikely that the Perl module has translated# /usr/include/netinet/udplite.h, we use the corresponding numbers:#define UDPLITE_SEND_CSCOV 10 /* Actual coverage length */#define UDPLITE_RECV_CSCOV 11 /* Minimum acceptable coverage */setsockopt(SOCKET, $proto, 10, $cscov) or die "setsockopt: $!";while(<STDIN>) { send(SOCKET, $_, 0, $portaddr) == length($_) or die "cannot send to $ipaddr#$PORTNO: $!\n";}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -