0
import socket
IP = "127.0.0.1"
PORT = 5200
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connecting to remote computer 80
server_address = (IP,PORT)
sock.connect(server_address)
# Sending data to server
x = input('enter firstname:')
sock.send(x)
y = input("enter lastname:")
sock.send(y)
server_msg = sock.recv(1024)
print (server_msg)
# Closing the socket
sock.close()
當我運行的代碼它,我得到這個錯誤「一類字節對象是必需的,而不是‘海峽’」,任何想法如何解決呢? 當我輸入名字時,出現此錯誤。類字節對象是必需的,而不是「海峽」