wie schon im Threndname erwähnt bekomme ich immer folgende Meldung wenn ich mich mit dem Server verbinde und dann eine Nachnicht vom Server zum Client schicken will.
Code: Alles auswählen
TypeError: 'int' does not support the buffer interface
Code: Alles auswählen
import socket
HOST = ''
PORT = 50007
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print('Connected by', addr)
command = ""
while (command != "/ende"):
command = input()
if (command == "/sensless"):
print(">> sensless command sended")
conn.send("sensless line of code")
else:
print(">> "+command)
conn.send(command)
else:
print("socket closed")
conn.close()
Code: Alles auswählen
# Echo client program
import socket
HOST = 'localhost' # The remote host
PORT = 50007 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
recived = s.recv(1024)
s.close()
print('Received, and closed reciving', repr(data))