title: Can't get a connection between two socket scripts
body: <p>I am trying to build a tkinter messaging app using the socket module in python, I was testing it, but two copies of the script cannot connect to each other (one hosting and the other connecting). The create_messaging_screen() method never runs.</p>
  <pre><code>import socket
  from threading import Thread
  import tkinter as tk
  
  default_port = 43777
  self_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  def client_link():
      self_socket.connect(('', default_port))
      create_messenging_screen()
      self_socket.sendall((&quot;hi to you too&quot;).encode(&quot;utf-8&quot;))
      while True:
          try:
              print(self_socket.recv(1024))
          except:pass
  
  def host_link():
      self_socket.bind(('', default_port))
  
      self_socket.listen(1)
  
      global client_conn
      client_conn, client_addr = self_socket.accept()
      create_messenging_screen()
  
      client_conn.sendall((&quot;hi&quot;).encode(&quot;utf-8&quot;))
      print(client_addr)
  
      while True:
          try:
              print(client_conn.recv(1024))
          except:pass
  
  def continue_setup(route):
      if route == None:
          Thread(target=host_link).start()
      else:
          Thread(target=client_link).start()
  
  
  def create_messenging_screen():
     #clear the window and create the messaging GUI
  
  window = tk.Tk()
  #IM app connection screen
  
  #host a chatroom
  button(window, command=lambda: continue_setup(None))
  #join a chatroom
  button(window, command=lambda: continue_setup(1))
  
  window.mainloop()
  </code></pre>