Initialisation

This commit is contained in:
Maximilien Rigaut 2021-09-30 19:37:04 +02:00
parent 7777a02d97
commit 3633d85728
2 changed files with 33 additions and 3 deletions

View File

@ -268,11 +268,11 @@ class analogController(object):
##################### #####################
# TESTING # TESTING
if __name__ == '__main__': if __name__ == '__main__':
_HOSTS=[["127.0.0.1",10500]] # Test server
ctrl1=analogController(*_HOSTS[0]) ctrl1=analogController(*_HOSTS[0])
ctrl1.connectionSequence() ctrl1.connectionSequence()
ctrl1.waitfor("") # ctrl1.waitfor("")
# except ConnectionRefusedError: # except ConnectionRefusedError:
# # Receive data # # Receive data
# print('# Receive data from server') # print('# Receive data from server')

30
falseserver.py Normal file
View File

@ -0,0 +1,30 @@
def sequenceAnswers(seq):
def Main():
host = "127.0.0.1"
# reverse a port on your computer
# in our case it is 12345 but it
# can be anything
port = 10500
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((host, port))
print("socket binded to port", port)
# put the socket into listening mode
s.listen(5)
print("socket is listening")
# a forever loop until client wants to exit
while True:
# establish connection with client
c, addr = s.accept()
# Start a new thread and return its identifier
start_new_thread(sequenceAnswers, (sequence,))
s.close()
if __name__ == '__main__':
Main()