title: Cant find bug in python client socket program
body: <p>I want to clarify. This works. The program connects to the server and the server just sends a welcome message, But it gives me that error when the server sends the message back to the client. and I cant figure it out and Im new to sockets so Im trying to also learn from this mistake.. the <strong>entire</strong> error message is at the bottom in comments</p>
  
  <pre><code>import socket
  
  class client:
      def __init__(self,s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)):
          self.s = s
  
      def connect(self,server_ip = 'ip'): # i replaced the actual ip with 'ip' 
      for safety reasons (obviously)
          self.s.connect(('ip', 12345))
          while True:
             data = self.s.recv(1024).decode('utf-8')
             if not data:
                 break
             print(data)
          self.s.close()
  
   if __name__ == '__main__':
   cl = client()
   cl.connect()
  </code></pre>
  
  <p>This is the Error:</p>
  
  <pre><code> Traceback (most recent call last):
   File "client.py", line 18, in &lt;module&gt;
     cl.connect()
   File "client.py", line 10, in connect
     data = self.s.recv(1024).decode('utf-8')
   OSError: [Errno 9] Bad file desscriptor
  </code></pre>