text: import socket
  import threading
  import threading
  from time import sleep
  import datetime as dt
  
  HOST = '127.0.0.1' # Use Server IP
  PORT = 8000 # Use Server Port
  HEADERLEN = 10
  
  name = input("Enter nickname: ")
  print(f'Connecting to {HOST}:{PORT}...\n')
  
  # Connecting To Server
  def connect():
    clnt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    clnt.connect((HOST, PORT))
  
    def getMsg(skt):
      full_msg = ''
      new = True
      while True:
          msg = skt.recv(HEADERLEN)
          if new:
              msglen = int(msg)
              new = False
          if len(msg) == 0:
              break
          full_msg += msg.decode()
          if len(full_msg)-HEADERLEN == msglen:
              return full_msg[HEADERLEN:]  # returns DECODED message
  
  
    def sendMsg(clnt, msg):
      msg = f'{len(msg):<{HEADERLEN}}' + msg
      msg = msg.encode()
      clnt.send(msg)  # sends ENCODED message
  
    def receive():
      while True:
          try:
              msg = getMsg(clnt)
              if msg == 'name':
                  sendMsg(clnt, name)
              else:
                  x = dt.datetime.now()
                  time = x.strftime(f"%H:%M:%S")
                  date = x.strftime("%d/%m/%Y") #Soon
                  print(f"{time} >> {msg}")
          except:
              print(f"\nError, Possible Server Down.")
              sleep(2)
  
    def write():
      while True:
          msg = '{}: {}'.format(name, input())
          sendMsg(clnt, msg)
  
  
    recv_thread = threading.Thread(target=receive)
    recv_thread.start()
  
    write_thread = threading.Thread(target=write)
    write_thread.start()
  connect()
  