started testing with telnet, moved 0 char to strlen(buf)-2 to account for rn