Quote:show what you've tried
I attached a photo to previous reply. Don't view it ? I'm adding code now.
import socket class client: def __init__(self): self.HOST = '192.168.1.55' # The server's hostname or IP address, NodeMCU IP Address self.PORT = 80 # The port used by the server, PORT NUMBER in ARDUINO CODE def transfer_data(self): s.connect((HOST, PORT)) s.sendall(b'Hello, world') self.data = s.recv(1024) # To try run stand-alone if __name__ == '__main__': cl = client() cl.transfer_data() print(cl.data)
Error: > & "C:/Program Files/Python37/python.exe" c:/Users/User/Desktop/PYQT/client.py
Traceback (most recent call last):
File "c:/Users/User/Desktop/PYQT/client.py", line 16, in <module>
cl.transfer_data()
File "c:/Users/User/Desktop/PYQT/client.py", line 9, in transfer_data
s.connect((HOST, PORT))
NameError: name 's' is not defined