- combine similar functions in telnet_server.c