mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 20:21:04 +00:00
examples: Fix Python coding style
This commit is contained in:
@@ -10,8 +10,8 @@ from builtins import input
|
||||
import socket
|
||||
import sys
|
||||
|
||||
# ----------- Config ----------
|
||||
PORT = 3333;
|
||||
# ----------- Config ----------
|
||||
PORT = 3333
|
||||
IP_VERSION = 'IPv4'
|
||||
IPV4 = '192.168.0.167'
|
||||
IPV6 = 'FE80::32AE:A4FF:FE80:5288'
|
||||
@@ -31,14 +31,14 @@ try:
|
||||
sock = socket.socket(family_addr, socket.SOCK_STREAM)
|
||||
except socket.error as msg:
|
||||
print('Could not create socket: ' + str(msg[0]) + ': ' + msg[1])
|
||||
sys.exit(1);
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
sock.connect((host, PORT))
|
||||
except socket.error as msg:
|
||||
print('Could not open socket: ', msg)
|
||||
sock.close()
|
||||
sys.exit(1);
|
||||
sys.exit(1)
|
||||
|
||||
while True:
|
||||
msg = input('Enter message to send: ')
|
||||
@@ -46,6 +46,7 @@ while True:
|
||||
msg = msg.encode()
|
||||
sock.sendall(msg)
|
||||
data = sock.recv(1024)
|
||||
if not data: break;
|
||||
print( 'Reply: ' + data.decode())
|
||||
sock.close()
|
||||
if not data:
|
||||
break
|
||||
print('Reply: ' + data.decode())
|
||||
sock.close()
|
||||
|
Reference in New Issue
Block a user