mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
asio: added socket timeout for example tests
This commit is contained in:
parent
b674fa0b99
commit
c0186858ad
@ -34,10 +34,12 @@ def chat_server_sketch(my_ip):
|
||||
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
|
||||
@ -86,7 +88,7 @@ def test_examples_protocol_asio_chat_client(env, extra_data):
|
||||
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:
|
||||
|
@ -40,6 +40,7 @@ def test_examples_protocol_asio_chat_server(env, extra_data):
|
||||
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)
|
||||
|
@ -41,6 +41,7 @@ def test_examples_protocol_asio_tcp_server(env, extra_data):
|
||||
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)
|
||||
|
@ -41,6 +41,7 @@ def test_examples_protocol_asio_udp_server(env, extra_data):
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user