ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to write a program to execute some commands on a remote host (ex. telnet to a linux router and excute IOS commands there). The problem is I want to know when I am connected and when to send he command etc.
In other words, Suppose I create a socket connect etc. Now when to know that the 3 way handshake has finished, when that it prompts me to enter a user name and wheter it accepted it after that or not ... etc.
when calling connect, it doesn't return until the 3 way handshake is complete. atually, to be precise it returns after recieving the server's SYN/ACK packet and then sends it's SYN packet. but that stuff is all managed by the underlying protocols, you dont worry about that at the application level. however, you are talking about telnet, and that is the protocol that you have to worry about. have you read the rfc?
Actually no !!
I didn't read the RFC ... I used to think of Telnet as a pure TCP (i.e It just send blocks of data in the TCP payload ). That's why I can use the telnet application to communicate with any other protocols by writing that protocol commands over Telnet ... Am I right ??!!
Any ways I think it may help
Thanks
In TCP sockets there are 2 kinds of data, right data which you want to send or receive and also Out-Of-Base (OOB) data, for example ACK (acknowledge) which 'tells' the client, that packet has been received by the server and also otherwise. (that's quite short way to describe it). All kinds of TCP sockets uses this kind of data (TCP protocol is exactly based on it). But you're right that Telnet is pure TCP, because first kind of packets I said about is exactly what you receive and what you send, so there's no RTF for telnet.
first off, ACKS are not OOB(out-of-band also) data. 2nd off, oob data is HARDLY ever used. but since you brought it up, telnet in fact does use OOB data to send important control characters. RTF? there is of course an RFC, b/c it is an APPLICATION LEVEL PROTOCOL:
Here's the RFC for the Telnet protocol. If you do a search for "telnet" at this site, you will find that there are many more which allow for additional extensions, but you probably won't need those, depending on what you want to do.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.