⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udpliteclient.pl

📁 udp-lite for upd lite linux kernel
💻 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";}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -