描述
此函數告訴係統您不再期望使用 getprotoent 從協議列表中讀取條目。
用法
以下是此函數的簡單語法 -
endprotoent
返回值
此函數不返回任何值。
示例
以下是顯示其基本用法的示例代碼 -
#!/usr/bin/perl
while(($name, $aliases, $protocol_number) = getprotoent()) {
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Protocol Number = $protocol_number\n";
}
setprotoent(1); # Rewind the database.
while(($name, $aliases, $protocol_number) = getprotoent()) {
print "Name = $name\n";
print "Aliases = $aliases\n";
print "Protocol Number = $protocol_number\n";
}
endprotoent(); # Closes the database
執行上述代碼時,會產生以下結果 -
Name = ip Aliases = IP Protocol Number = 0 Name = hopopt Aliases = HOPOPT Protocol Number = 0 Name = icmp Aliases = ICMP Protocol Number = 1 Name = igmp Aliases = IGMP Protocol Number = 2 Name = ggp Aliases = GGP Protocol Number = 3 Name = ipencap Aliases = IP-ENCAP Protocol Number = 4 Name = st Aliases = ST Protocol Number = 5 Name = tcp Aliases = TCP Protocol Number = 6 . . . Name = manet Aliases = manet Protocol Number = 138 Name = hip Aliases = HIP Protocol Number = 139 Name = shim6 Aliases = Shim6 Protocol Number = 140
相關用法
- Perl endpwent用法及代碼示例
- Perl endnetent用法及代碼示例
- Perl endhostent用法及代碼示例
- Perl endservent用法及代碼示例
- Perl exists()用法及代碼示例
- Perl exp用法及代碼示例
- Perl each()用法及代碼示例
- Perl exists用法及代碼示例
- Perl eof用法及代碼示例
- Perl exec用法及代碼示例
- Perl sin()用法及代碼示例
- Perl abs()用法及代碼示例
- Perl kill用法及代碼示例
- Perl chop()用法及代碼示例
- Perl wantarray用法及代碼示例
注:本文由純淨天空篩選整理自 Perl endprotoent Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。