48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
|
# coding: utf-8
|
||
|
import os
|
||
|
import os.path
|
||
|
import codecs
|
||
|
import json
|
||
|
import time
|
||
|
|
||
|
|
||
|
#----------------------------------------------------------------------------
|
||
|
class test_cl(object):
|
||
|
globalNumber = 0
|
||
|
|
||
|
|
||
|
exposed = True
|
||
|
#----------------------------------------------------------------------------
|
||
|
|
||
|
#----------------------------------------------------------------------------
|
||
|
def __init__(self):
|
||
|
#----------------------------------------------------------------------------
|
||
|
pass
|
||
|
|
||
|
#-----------------------------------------------------------------------------
|
||
|
def REFRESH(self, value):
|
||
|
print("Value receivt: %s" % value)
|
||
|
starttime= time.time()
|
||
|
#server und client selbe zahl hat wartezustand
|
||
|
while (int(value) == int(self.globalNumber)):
|
||
|
time.sleep(1)
|
||
|
print("Sessiontimer: %d" % (time.time() - starttime))
|
||
|
|
||
|
if (time.time() - starttime) > 3600:
|
||
|
print("Client down")
|
||
|
return json.dumps(self.globalNumber)
|
||
|
|
||
|
print("new Value sent: %d" %self.globalNumber)
|
||
|
return json.dumps(self.globalNumber)
|
||
|
|
||
|
def INC(self):
|
||
|
self.globalNumber = self.globalNumber + 1
|
||
|
print(self.globalNumber)
|
||
|
#-----------------------------------------------------------------------------
|
||
|
def default():
|
||
|
#-----------------------------------------------------------------------------
|
||
|
pass
|
||
|
|
||
|
|
||
|
|
||
|
# EOF
|