Sammlung
This commit is contained in:
Binary file not shown.
48
Sammlung/Praktikum/2/ias-p2_a0.02/app/test.py
Normal file
48
Sammlung/Praktikum/2/ias-p2_a0.02/app/test.py
Normal file
@ -0,0 +1,48 @@
|
||||
# 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
|
Reference in New Issue
Block a user