TypeError - Client error in python

前端 未结 2 1219
孤独总比滥情好
孤独总比滥情好 2021-01-23 00:59

I created a Client/Server code in python. Server works well and get listen on 8000 port, but when I connect to it via client and then I try to send a message to server I get the

2条回答
  •  悲哀的现实
    2021-01-23 01:28

        TcpSocket.send(sendData)
    

    Looks like send accepts only bytes instances. Try:

        TcpSocket.send(bytes(sendData, "ascii")) #... or whatever encoding is appropriate
    

提交回复
热议问题