本文整理匯總了Python中Function.get_ipv4方法的典型用法代碼示例。如果您正苦於以下問題:Python Function.get_ipv4方法的具體用法?Python Function.get_ipv4怎麽用?Python Function.get_ipv4使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Function
的用法示例。
在下文中一共展示了Function.get_ipv4方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: logout
# 需要導入模塊: import Function [as 別名]
# 或者: from Function import get_ipv4 [as 別名]
def logout(ip):
print ("\n>>> LOGOUT")
i = 0
pk = pack.logout()
s = func.create_socket_client(func.get_ipv4(ip), const.PORT);
if s is None:
func.error("Errore nella chiusura del demone:" + func.get_ipv4(ip))
else:
s.sendall(pk)
s.close()
i = i + 1
s = func.create_socket_client(func.get_ipv6(ip), const.PORT);
if s is None:
func.error("Errore nella chiusura del demone:" + func.get_ipv6(ip))
else:
s.sendall(pk)
s.close()
i = i + 1
if i is 2:
print ("Logout eseguito con successo.")
示例2: input
# 需要導入模塊: import Function [as 別名]
# 或者: from Function import get_ipv4 [as 別名]
listPkt = []
listResultQuery = []
####### INIZIO CLIENT #######
nGroup = input("Inserire il numero del gruppo: ")
nElement = input("Inserire il numero dell'elemento del gruppo: ")
host = ("172.030." + func.format_string(nGroup, const.LENGTH_SECTION_IPV4, "0") +
"." + func.format_string(nElement, const.LENGTH_SECTION_IPV4, "0") +
"|fc00:0000:0000:0000:0000:0000:" + func.format_string(nGroup, const.LENGTH_SECTION_IPV6, "0") +
":" + func.format_string(nElement, const.LENGTH_SECTION_IPV6, "0"))
print ("IP:", host)
####### DEMONI
daemonThreadv4 = daemon.Daemon(func.get_ipv4(host), listNeighbor, listPkt, listResultQuery, host)
daemonThreadv6 = daemon.Daemon(func.get_ipv6(host), listNeighbor, listPkt, listResultQuery, host)
daemonThreadv4.setName("DAEMON IPV4")
daemonThreadv6.setName("DAEMON IPV6")
daemonThreadv4.start()
daemonThreadv6.start()
# Menù di interazione
while True:
choice = input("\n\nScegli azione:\nupdate\t - Update Neighborhood\ndelete\t - Delete Neighborhood\nview\t - View Neighborhood\nsearch\t - Search File\nquit\t - Quit\n\n")
if (choice == "update" or choice == "u"):
updateNeighbor(host, listNeighbor)
elif (choice == "delete" or choice == "d"):
del listNeighbor[:]