从服务器中传递数据的Python方法

2024-05-13 12:09:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要知道如何在这种情况下将数据传递给valueList,比如一次,然后等待几秒钟,然后再次将数据传递给valueList。我不希望数据被不断地传递,相反,我希望它被传递一次,然后几秒钟,然后再传递几秒钟。你知道吗

screenw = 0
screenh = 0
while 1:
    client_socket.send("loc\n")
    data = client_socket.recv(8192)
    valueList = data.split()

    if (not(valueList[-1] == "eom" and valueList[0] == "start")):
        #print "continuing.."
            continue

        if(screenw != int(valueList[2])):
            screenw = int(valueList[2])
            screenh = int(valueList[3])

Tags: 数据clientsenddataif情况socketloc