本文整理汇总了Python中Client.Client.send_packet方法的典型用法代码示例。如果您正苦于以下问题:Python Client.send_packet方法的具体用法?Python Client.send_packet怎么用?Python Client.send_packet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client.Client
的用法示例。
在下文中一共展示了Client.send_packet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: client_function
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import send_packet [as 别名]
def client_function():
print "Connecting to a server..."
sys.stdout.write("Server?: ")
host = stdin.readline().rstrip("\n")
sys.stdout.write("Port?: ")
port = stdin.readline().rstrip("\n")
c = Client(host, int(port))
c.send_packet("hello!")
sleep(.01)
i = 0
#wait to get packetConfirm
while i < 3:
c.Loop()
sleep(.1)
i += 1
示例2: ServerObj
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import send_packet [as 别名]
from ServerObj import ServerObj
from Client import Client
import sys
from sys import stdin
from time import sleep
sys.stdout.write("Server?: ")
host = stdin.readline().rstrip("\n")
sys.stdout.write("Port?: ")
port = stdin.readline().rstrip("\n")
s = ServerObj(localaddr=(host, int(port)));
sleep(1)
c = Client(host, int(port));
c.send_packet("hello!");
c.Loop()
s.update()