HI,
I have a device that exposes a telnet interface which you can log into using a username and password and then manipulate the working of the device.
I have to write a C program that hides the telnet aspect from the client and instead provides an interface for the user to control the device.
What would be a good way to proceed. I tried writing a simple socket program but it stops at the login prompt. My guess is that i am not following the TCP protocol.
Has anyone attempted this, is there an opensource library out there to do this?
Thanks
Addition:
Eventually i wish to expose it through a web api/webservice. The platform is linux.
While telnet is almost just a socket tied to a terminal it's not quite.  I believe that there can be some control characters that get passed shortly after the connection is made.  If your device is sending some unexpected control data then it may be confusing your program.
If you haven't already, go download wireshark (or tshark or tcpdump) and monitor your connection.  Wireshark (formerly ethereal) is cross platform and pretty easy to use for simple stuff.  Filter with tcp.port == 23
Writing a telnet client