python socket programming OSError: [WinError 10038] an operation was attempted on something that is not a socket

前端 未结 1 1847
礼貌的吻别
礼貌的吻别 2021-01-18 02:10

I am working on this code

from socket import *
HOST = \'localhost\'
PORT = 21567
BUFSIZ = 1024
ADDR = (HOST, PORT)
serversock = socket(AF_INET, SOCK_STREAM)
         


        
相关标签:
1条回答
  • 2021-01-18 02:22

    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.

    0 讨论(0)
提交回复
热议问题