title: AttributeError in python code with socket
body: <p>I'm having an AttributeError that says "AttributeError: 'socket' object has no attribute 'upper'". I'm pretty sure I created and established the connection properly, and am still unsure what to do after consulting the socket documentation.</p>
  
  <p>Thank you.</p>
  
  <pre class="lang-py prettyprint-override"><code>
  import socket
  from _thread import *
  import threading
  
  print_lock = threading.Lock()
  list_of_clients = [] 
  
  def threaded(data, addr, s):
    s.sendto(data.upper(), addr)
    while True:
      message = s.recv(1024)
      if not message:
        print('Bye')
        print_lock.release()
        break
      message = message.upper()
      print("Sending message to " + addr[0])
      s.sendto(message, addr)
    data.close()
  
  def Main():
  
    list_of_clients = []
    serverName = 'localhost'
    serverPort = 12000
  
    with socket.socket(socket.AF_INET , socket.SOCK_STREAM) as serverSocket:
      serverSocket.connect((serverName, serverPort))
      while True :
        print('Ready to ping...')
        data, addr = serverSocket.accept()
        print(type(data))
        print_lock.acquire()
        print("Client connected ip:&lt;" + str(addr) + "&gt;")
  
        start_new_thread(threaded, (data, addr, serverSocket))
        print("Continue")
  
  if __name__ == '__main__':
    Main()
  
  </code></pre>