setnetent STAYOPEN |
由于getintent()检索的信息在网络数据库中的下一行,然后setnetent集(或重置)枚举的主机项的设置开始。这个函数应该被调用之前第一次调用getnetent。STAYOPEN参数是可选的,在大多数系统上未使用过的。
Nothing
试试下面的例子:
#!/usr/bin/perl
#by www.gitbook.net
use Socket;
while ( ($name, $aliases, $addrtype, $net) = getnetent() ){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addrtype = $addrtype\n";
print "Net = $net\n";
}
setnetent(1); # Rewind the database;
while ( ($name, $aliases, $addrtype, $net) = getnetent() ){
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Addrtype = $addrtype\n";
print "Net = $net\n";
}
endnetent(); # Closes the database;