Here is a snippet of code:
def CriarServer(self):
Host = self.Txt1.get()
Port = self.Txt2.get()
sockobj = socket(AF_INET, SOCK_STREAM) #Erro
sockobj.bind((Host, Port))
sockobj.listen(5)
while True:
data = conexão.recv(1024)
if not data: break
conexão.close()
Since I'm in a program in Tkinter, I asked Python to take the text of two entries, one for the host and one for the input, but when you paste the text from a Form it comes as a string and the bind socket only accepts integers to do the assignment. How do I convert the string to int
?
Error:
sockobj.bind (int (Host, Port)) TypeError: 'str' object can not be interpreted as an integer.