I am working on this code
from socket import * HOST = \'localhost\' PORT = 21567 BUFSIZ = 1024 ADDR = (HOST, PORT) serversock = socket(AF_INET, SOCK_STREAM)
You are closing the clientsock after reading only part of the data.
clientsock.close()
is at the wrong level of indentation. Move it to the left by one step.