title: Will TCP Socket Server client connection fd cause memory leak?
body: <p>I don't if i need to close the client socket handle( conn ) such as "conn.close()" ?</p>
  
  <p>If I run multithread to handler the client socket fd ( conn ). Does it cause memory leak if the server runs too long time?</p>
  
  <p>Will the server not close the client socket fd if client no invokes conn.close()?</p>
  
  <p>Following is my tcp-socket server code:</p>
  
  <pre><code># coding: utf-8
  
  import socket
  import os, os.path
  import time
  
  sockfile = "./communicate.sock"
  
  if os.path.exists( sockfile ):
    os.remove( sockfile )
  
  print "Opening socket..."
  
  server = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM )
  server.bind(sockfile)
  server.listen(5)
  
  print "Listening..."
  while True:
    conn, addr = server.accept()
    print 'accepted connection'
    while True: 
      data = conn.recv(1024)
  
      if not data:
          break
      else:
          print "-" * 20
          print data
          print "DONE" == data
          if "DONE" == data:
              # If I need to invoke conn.close() here?
              break
  print "-" * 20
  print "Shutting down..."
  
  server.close()
  os.remove( sockfile )
  print "Done"
  </code></pre>