print("Starting the server on {}".format(my_ip))
port=2222
s=socket(AF_INET, SOCK_STREAM)
+ s.settimeout(600)
s.bind((my_ip, port))
s.listen(1)
q,addr=s.accept()
print("connection accepted")
+ q.settimeout(30)
q.send(g_msg_to_client)
data = q.recv(1024)
# check if received initial empty message
time.sleep(1)
print(g_client_response)
# 6. evaluate host_server received this message
- if (g_client_response[4:] == test_msg):
+ if (g_client_response[4:7] == test_msg):
print("PASS: Received correct message")
pass
else:
data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30)
# 3. create tcp client and connect to server
cli = socket(AF_INET,SOCK_STREAM)
+ cli.settimeout(30)
cli.connect((data[0],80))
cli.send(test_msg)
data = cli.recv(1024)
data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30)
# 3. create tcp client and connect to server
cli = socket(AF_INET,SOCK_STREAM)
+ cli.settimeout(30)
cli.connect((data[0],80))
cli.send(test_msg)
data = cli.recv(1024)
data = dut1.expect(re.compile(r" sta ip: ([^,]+),"), timeout=30)
# 3. create tcp client and connect to server
cli = socket(AF_INET, SOCK_DGRAM)
+ cli.settimeout(30)
cli.connect((data[0], 80))
cli.send(test_msg)
data = cli.recv(1024)