The operation of python socket TCP instance has been unsuccessful.

this is the client of the instance

from socket import *

HOST="localhost"
PORT=10001
BUFFER=1024
ADDRESS=(HOST,PORT)

clientSocet=socket(AF_INET,SOCK_STREAM)
clientSocet.connect(ADDRESS)
while True:
    data=input(">")
    if not data:
        break
    clientSocet.send(data.encode())
    data=clientSocet.recv(BUFFER).decode()
    if not data:
        break
    print(data)
clientSocet.close()

The

run shows the above error.

Aug.08,2021

put the code in the file and use python file.py to execute

or

add a new line before clientSocet.close () , because in an interactive environment, if a new line is not added at the end of the code block, the environment thinks that the following statement belongs to the code block and the following statement is not indented, a syntax error occurs

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37b5a-2c0bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37b5a-2c0bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?