Telnet provides a lot more than would be required for your simple use case: according to Telnet Protocol Specification (RFC 854):
The TELNET Protocol is built upon three main ideas: first, the
concept of a "Network Virtual Terminal"; second, the principle of
negotiated options; and third, a symmetric view of terminals and
processes.
You don't need any of these, as you simply want to send and receive messages. Netcat can handle these simple TCP connections on both ends. Here, the -vvv
is just for verbosity, to better understand what's happening.
Server
$ nc -l 12765 -vvv
Listening on [0.0.0.0] (family 2, port 12765)
Connection from client.example.net 58724 received!
Client
$ nc example.com 12765 -vvv
example.com [192.0.2.1] 12765 (?) open
Now, whatever is typed into either one of these appears in the other, after hitting enter.