title: why is the MUD server not receiving data?
body: <p>I'm making a mud client, and I'm using Duris to connect. But the server doesn't seem to receive what I have been sending it, as its sending back idle timeout after waiting a minute or so.
  please note that I'm new to sack overflow, I do not yet understand how to use the code block.
  If someone can tell me what encode typical muds use that would be great.</p>
  <p>my code:</p>
  <pre><code>import asyncio
  import socket
  import socket
  import os
  import pyfiglet
  import time
  import datetime
  import websockets
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
  class menu:
      def debug_menu():
          print(&quot;--debug--&quot;)
          print(&quot;-&quot;*50)
      def menu_1():
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          print(&quot; &quot;)
          result = pyfiglet.figlet_format(&quot;-- D R A A K&quot;, font = &quot;3-d&quot; )
          print(result)
          print(&quot; &quot;)
          result = pyfiglet.figlet_format(&quot;-- MUD &quot;, font = &quot;3-d&quot; )
          print(result)
          print(&quot; &quot;)
          result = pyfiglet.figlet_format(&quot;-- CLIENT &quot;, font = &quot;3-d&quot; )
          print(result)
          print(&quot; &quot;)
          print(&quot;-&quot;*50)
          print(&quot;Version: 1.0.0&quot;)
  class main:
      def recv(triggers,triggers_act,alias,alias_act):
          message=sock.recv(1000)
          temp=0
          while True:
              try:
                  if message in triggers[temp]:
  
                      print(f&quot;trig--{triggers_act[temp]}&quot;)
                      main.send_main(triggers_act[temp],alias,alias_act)
                      return
              except:
                  print(type(message))
                  return message.decode(dec)
              temp+=1
  
      def send_main(message,alias,alias_act):
          temp=0
          while True:
              try:
                  if message in alias[temp]:
                      sock.sendall(alias_act[temp].encode(dec))
                      break
              except:
                  sock.sendall(message.encode(dec))
                  break
              temp+=1
  
      def get_url(url,debug):
          return socket.gethostbyname(url)
      def disconnect(debug):
          if debug==False:
              try:
                  sock.close()
                  print(&quot;--Success--&quot;)
              except:
                  print(&quot;--ERROR--&quot;)
          if debug==True:
              sock.close()
  
      def connect(ip,port,debug):
  
          if debug==False:
              sock.connect((ip,port))
  
              print(&quot;--Connection success--&quot;)
              print(f&quot;ip: {ip}&quot;)
              print(f&quot;port: {port}&quot;)
          if debug==True:
              sock.connect((ip,port))
      def brute_connect(ip,debug):
          port=0
  
  
          while True:
              try:
                  sock.connect((ip,port))
  
                  print(&quot;--Connection success--&quot;)
                  print(f&quot;ip: {ip}&quot;)
                  print(f&quot;port: {port}&quot;)
  
              except:
                  os.system(&quot;clear&quot;)
                  print(&quot;--Failure--&quot;)
                  print(f&quot;ip: {ip}&quot;)
                  print(f&quot;port: {port}&quot;)
                  return port
              port+=1
  
  
  
      def ping(name):
          name='ping '+name
          os.system(name)
      def ip_find(url):
          ip = socket.gethostbyname(url)
          return ip
  class Shell:
      def main_shell(com,debug):
          com_temp=com.split(str_split)
          if com_temp[0]==&quot;-shell&quot;:
              if com_temp[1]==&quot;clear&quot;:
                  os.system(&quot;cls&quot;)
              if com_temp[1]==&quot;reopen&quot;:
                  print(&quot;Restarting...&quot;)
                  time.sleep(1)
                  os.system(&quot;Dmud_Main.py&quot;)
  
  
              if com_temp[1]==&quot;quit&quot;:
                  quit()
          else:
              commands.main(com,debug)
  
  
      pass
  
  class commands:
      def main(com,debug):
          com=com.split(str_split)
          if debug==True:
              print(&quot;debug=True&quot;)
          if com[0]==&quot;-timeout&quot;:
              sock.setdefaulttimeout(int(com[1]))
          if com[0]==&quot;-disconnect&quot;:
              main.disconnect(debug)
          if com[0]==&quot;-connect&quot;:
              if debug==True:
  
                  com=com[1]
                  com=com.split(&quot;:&quot;)
                  main.connect(com[0],int(com[1]),debug)
              elif debug==False:
                  try:
                      com=com[1]
                      com=com.split(&quot;:&quot;)
                      main.connect(com[0],int(com[1]),debug)
  
                  except:
                      print(&quot;--Failure--&quot;)
                      print(f&quot;ip: {com[0]}&quot;)
                      print(f&quot;port: {com[1]}&quot;)
  
  
          if com[0]==&quot;-url&quot;:
              ip=main.get_url(com[1],debug)
  
              print(f&quot;--{ip}--&quot;)
      pass
  
  menu.menu_1()
  global debug
  global str_split
  global triggers
  global triggers_act
  global alias_act
  global alias
  alias=[]
  alias_act=[]
  triggers=[]
  triggers_act=[]
  str_split=&quot; &quot;
  dec=&quot;UTF-8&quot;
  debug=False
  while True:
  
      command=input(&quot;&gt;&gt;&gt; &quot;)
      temp_com=command.split(str_split)
      if temp_com[0]==&quot;-begin&quot;:
          while True:
              if debug==True:
                  print(&quot;--recieving--&quot;)
              print(main.recv(triggers,triggers_act,alias,alias_act))
              command=input(&quot;}} &quot;)
              if &quot;-&quot; in command:
                  Shell.main_shell(command,debug)
              else:
                  if debug==True:
                      print(&quot;--sending--&quot;)
                      print(f&quot;sent: {command}&quot;)
                  main.send_main(command,alias,alias_act)
                  print(&quot;--complete--&quot;)
      if temp_com[0]==&quot;-split&quot;:
          if temp_com[1]==&quot;r&quot;:
              print(f&quot;split: {str_split}&quot;)
          else:
              str_split=temp_com[1]
              print(f&quot;split: {str_split}&quot;)
      if temp_com[0]==
      if temp_com[0]==&quot;-debug&quot;:
          try:
              if temp_com[1]==&quot;true&quot;:
                  print(&quot;Debug is now true&quot;)
                  debug=True
  
  
              if temp_com[1]==&quot;false&quot;:
                  print(&quot;Debug is now false&quot;)
                  debug=False
          except:
              print(f&quot;Debug={debug}&quot;)
      else:
          Shell.main_shell(command,debug)
  </code></pre>
  <p>input and output:</p>
  <pre><code>&gt;&gt;&gt; -connect mud.durismud.com:2002
  --Connection success--
  ip: mud.durismud.com
  port: 2002
  &gt;&gt;&gt; -debug true
  Debug is now true
  &gt;&gt;&gt; -begin
  --recieving--
  &lt;class 'bytes'&gt;
  Looking up your hostname...
  Please enter term type (&lt;CR&gt; for ANSI, '1' for Generic, '9' for Quick):
  }} 1
  --sending--
  sent: 1
  --complete--
  --recieving--
  &lt;class 'bytes'&gt;
  Idle Timeout
  
  }}
  </code></pre>