smarnach / pyexiftool

a Python library to communicate with an instance of Phil Harvey's excellent ExifTool command-line application.
Other
270 stars 111 forks source link

WINERROR 10038 #35

Closed Overlrd closed 2 years ago

Overlrd commented 2 years ago

Hi guys i coding a chatroom with socket modul in python an i get this error. I think you can help me. My code is bellow

`import socket from tkinter import * import tkinter as tkinter import threading from tkinter import simpledialog from tkinter import scrolledtext HOST ="192.168.1.6" PORT =5051

class Client: def init(self, host, port): self.sock =socket.socket(socket.AF_INET, socket.SOCK_STREAM ) self.sock.connect((host, port)) msg = tkinter.Tk() msg.withdraw()

    self.nickname = simpledialog.askstring('Nickname', "Please choose a Nickname", parent=msg)
    self.gui_done = False

    self.running =True

    gui_thread = threading.Thread(target =self.gui_loop)
    receive_thread = threading.Thread(target = self.receive)

    gui_thread.start()
    receive_thread.start()

def gui_loop(self):
    self.win =tkinter.Tk()
    self.win.configure(bg="lightgray")

    self.chat_label = tkinter.Label(self.win, text="chat", bg="lightgray")
    self.chat_label.config(font=("Arial ", 12))
    self.chat_label.pack(padx=20, pady=5)

    self.chat_area= scrolledtext.ScrolledText(self.win)
    self.chat_area.pack(padx=20, pady=5)
    self.chat_area.config(state="disabled")

    self.msg_label = tkinter.Label(self.win, text="Message :", bg="lightgray")
    self.msg_label.config(font=("Arial" , 12))
    self.msg_label.pack(padx=20, pady=5)

    self.input_area = tkinter.Text(self.win, height=3, width=50)
    self.input_area.pack(padx=20, pady=5)

    self.send_button =tkinter.Button(self.win, text="Send", command=self.write)
    self.send_button.config(font=("Arial", 12))
    self.send_button.pack(padx=20, pady=5)

    self.gui_done = True

    self.win.protocol("WM_DELETE_WINDOW", self.stop)

    self.win.mainloop()

def write(self):
    message = f"{self.nickname}: {self.input_area.get('1.0', 'end')}"
            ####17 I get here an WINERROR 10038 I dont understand help me
    self.sock.send(message.encode('utf-8'))
            ####
    self.input_area.delete('1.0', 'end')

def stop(self):
    self.running= False
    self.win.destroy()
    self.sock.close()
    exit(0) 

def receive(self):
    while self.running:
        try:
            message = self.sock.recv(1024).decode('utf-8')
            if message =='NICK':
                self.sock.send(self.nickname.encode('utf-8'))
            else:
                if self.gui_done:
                    self.text_area.config(state='normal')
                    self.text_area.insert('end', message)
                    self.text_area.yview('end')
                    self.text_area.config(state='disabled')
        except ConnectionAbortedError :
            break
        except:
            print('Error')  
            self.sock.close()
            break

client= Client(HOST, PORT)
`

sylikc commented 2 years ago

did you post this on the wrong project?

Overlrd commented 2 years ago

excuse me i think its the wrong project