is this homework? rule number 6 says no homework questions allowed.
by information if you are asking CAN you do this, well YES you can do it. you can write a c or c++ program to do this. to run it with telnet just compile your application, and run the executable. eg:
./a.out
for more information on socket programming, search google for "socket programming in c"