Python Forum
How to combine data taken from server between client and GUI?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to combine data taken from server between client and GUI?
#6
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
Reply


Messages In This Thread
RE: How to combine data taken from server between client and GUI? - by bescf - Apr-01-2019, 03:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Paramiko Server -- Exception (server): Error reading SSH protocol banner ujlain 3 4,538 Jul-24-2023, 06:52 AM
Last Post: Gribouillis
  trying to stream data from a websocket to client tomtom 2 2,053 Jan-12-2023, 03:01 PM
Last Post: Vadanane
  Client/Server proper finalizing transfer wolfman5874 1 1,457 Jul-04-2022, 07:35 PM
Last Post: wolfman5874
Bug Problem connecting TLS client written in C++ and Twisted server gpropf 0 1,394 Jun-12-2022, 05:57 PM
Last Post: gpropf
  Server/client basic communication ebolisa 0 2,030 Sep-30-2021, 12:22 PM
Last Post: ebolisa
  Client server Multithreading Anan 6 5,881 Apr-21-2021, 08:19 PM
Last Post: SheeppOSU
Question Trouble with Client/Server reverse Shell! Gilush 0 2,782 Feb-03-2021, 01:04 PM
Last Post: Gilush
  Basic client server code question swisscheese 4 3,242 Dec-12-2020, 08:51 AM
Last Post: Larz60+
  How can i create a server for already existing client using Python? Chapanson 21 7,481 Aug-19-2020, 09:12 AM
Last Post: DeaD_EyE
  Simple TCP Client and TCP Server Problem Vapulabis 5 4,397 Jul-12-2020, 05:09 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020