KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to get a basic server (copied from Beginning Python) to send a str. The error: c.send( "XXX" ) TypeError: must be bytes or buffer, not str It seems to work when pickling an object. All of the examples I found, seem to be able to send a string no problem. Any help would be appreciated, Stephen import socket import pickle s = socket.socket() host = socket.gethostname() port = 80 s.bind((host, port)) s.listen(5) while True: c, addr = s.accept() print( "Got Connection From ", addr ) data = pickle.dumps(c) c.send( "XXX" ) #c.send(data) c.close()
Tags (comma-separated)
Save Edits
Cancel