Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
#!/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 \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() { send(SOCKET, $_, 0, $portaddr) == length($_) or die "cannot send to $ipaddr#$PORTNO: $!\n"; }