Я пытаюсь создать небольшой чат на PHP, но когда я пытаюсь подключиться через telnet, он делает очень странные вещи, например:
при первом подключении:
└─# telnet 127.0.0.1
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
you are the number: 1
you: Hi
you: this is a test
2: Hi this is also a test
2: i you: i^Hit bug : ^H is the bayou: ckspace toucj^Hh i said ^H is the back space touch^Myou: ^M^M ayou: nyou: dyou: ayou: nyou: dyou: ^M iyou: syou: eyou: nyou: tyou: eyou: ryou: ^M^M^M
2: n
2: t
2: h
2: e
2: u
2: h
2: e
2: f
you:
во втором соединении (другая оболочка):
└─$ telnet 127.0.0.1
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
you are the number: 2
you: Hi this is also a test
1: this is a test
1: it bug : is the ba
1: ckspace touch i said is the back space touch
1: a
1: n
1: d
1: a
1: n
1: d
1: i
1: s
1: e
1: n
1: t
1: e
1: r
you: iyou: nyou: tyou: hyou: eyou: uyou: hyou: ^M^M^Meyou: fyou: ^M
^M — когда я нажимаю Enter, а ^H — когда я нажимаю Backspace.
С Netcat это работает отлично.
Это мой код (я тестировал его с php server.php в Linux):
Подробнее здесь: https://stackoverflow.com/questions/798 ... range-data