title: Socket programming in Python error: "group argument must be None for now" and "SocketErr Errno. 111"
body: <p>I am trying to implement socket programming using Python.</p>
  
  <p><strong>server.py</strong></p>
  
  <pre><code>import socket
  from threading import Thread
  try:
      from SocketServer import ThreadingMixIn, ForkingMixIn
      from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
  except ImportError:
      from socketserver import ThreadingMixIn, ForkingMixIn
      from http.server import HTTPServer, BaseHTTPRequestHandler
  
  
  
  #from SocketServer import ThreadingMIxIn
  class ClientThread(Thread):
  
      def _init_(self,ip,port):
          Thread._init_(self)
          self.ip=ip
          self.port= port
          print ("[+] New server socket thread started for " + + ":" + str(port))
  
      def run(self):
          while True :
              data = conn.recv(2048)
              print ("Server received data:", data)
              MESSAGE = raw_input("Multithreaded Python Server : Enter response from sever Enter exit:")
  
              if MESSAGE == 'exit' :
          #break
                  conn.send(MESSAGE) 
  
  
  TCP_IP ='0.0.0.0'
  TCP_PORT = 2024
  BUFFER_SIZE = 20
  
  tcpServer = socket.socket()
  tcpServer.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
  tcpServer.bind((TCP_IP,TCP_PORT))
  threads=[]
  
  
  while True:
      tcpServer.listen(4)
      print ("Multithreaded python server: Waiting for connections from tcp clients...")
      (conn ,(ip,port)) = tcpServer.accept()
      newthread=ClientThread(ip,port)
      newthread.start()
      threads.append(newthread)
  
  
  for t in threads:
      t.join() #end
  </code></pre>
  
  <p><strong>client.py</strong></p>
  
  <pre><code>import socket
  
  host=socket.gethostname()
  port=2024
  BUFFER_SIZE= 2000
  MESSAGE = raw_input("tcpClientB: Enter message / Enter exit:")
  
  tcpClientB =socket.socket()
  tcpClientB.connect((host, port))
  
  while MESSAGE !='exit':
      tcpClientB.send(MESSAGE)
      data=tcpClientB.recv(BUFFER_SIZE)
      print ("Client received data",data)
      MESSAGE=raw_input("tcpClientB: Enter message to continue/ Enter exit:")
  
  tcpClientB.close()
  </code></pre>
  
  <p>When I am trying to run this, first <code>server.py</code> and then <code>client.py</code>, I get this error for <code>server.py</code></p>
  
  <pre><code>Multithreaded python server: Waiting for connections from tcp clients...
  Traceback (most recent call last):
    File "mserver.py", line 47, in &lt;module&gt;
      newthread=ClientThread(ip,port)
    File "/usr/lib/python2.7/threading.py", line 670, in __init__
      assert group is None, "group argument must be None for now"
  AssertionError: group argument must be None for now
  </code></pre>
  
  <p>and the following error from <code>client.py</code>:</p>
  
  <pre><code>python client2.py 
  tcpClientB: Enter message / Enter exit:exit
  Traceback (most recent call last):
    File "mclient2.py", line 10, in &lt;module&gt;
      tcpClientB.connect((host, port))
    File "/usr/lib/python2.7/socket.py", line 228, in meth
      return getattr(self._sock,name)(*args)
  socket.error: [Errno 111] Connection refused
  </code></pre>
  
  <p>I don't understand what I am doing wrong. And when I am entering <code>exit</code> in client after running it gives me <code>SocketErr Errno. 111</code>. </p>