connectionSocket.send("%s\r\n%s\r\n\r\n" %(first_header.encode(encoding='utf_8'), following_header.encode(encoding='utf_8')))
You are still sending a str
string object, because you used a string template (interpolating b'...'
byte literal syntax into it).
Encode the result of the str % (params)
operation instead:
data = "%s\r\n%s\r\n\r\n" % (first_header, following_header)
connectionSocket.send(data.encode(encoding='utf_8'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.