elvin226
asked on
How to open a telnet session using C?
In Perl, I learned to use the Net::Telnet module. It includes the following commands: login, waitfor, print cmd, close.
Is there a telnet library in C with the equivalent commands? How do I use them?
Is there a telnet library in C with the equivalent commands? How do I use them?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What I'm trying to do is an automated telnet script, not interactive, so I can't use system("telnet"). The program will be the one to send messages, not the user, and it has to wait for the remote machine's response before sending another message.
If you want a interactive telnet session, then you will have to write the complete program!
download the telent library ... it provides the API do the work ...
If you wish to do it with script, then use expect
http://expect.nist.gov/
using them, you wont have to write the whle code
If you wish to do it with script, then use expect
http://expect.nist.gov/
using them, you wont have to write the whle code
ASKER
sunnycoder,
what I'm asking for is the C library for telnet and examples of how to use it's functions...if there exists one.
I've already done it with Perl, now I want to learn how to do it in C.
what I'm asking for is the C library for telnet and examples of how to use it's functions...if there exists one.
I've already done it with Perl, now I want to learn how to do it in C.
take a look at any telent client coded in C
http://www.sofotex.com/download/Networking/Telnet/more3.html
http://linux.tucows.com/preview/220521.html
http://www.ararat.cz/synapse/
you would be having one with your own linux distribution too !!! tucows site has lots of clients ... search it for more info
http://www.sofotex.com/download/Networking/Telnet/more3.html
http://linux.tucows.com/preview/220521.html
http://www.ararat.cz/synapse/
you would be having one with your own linux distribution too !!! tucows site has lots of clients ... search it for more info
I too deserve points!:-))
-ssnkumar
-ssnkumar
The commands you will be using are socket(), bind(), listen(), accept(), send() and receive().
So, the first thing is to learn socket programming!:-)
But, both windows and Unix provide telnet program. Why don't you use this itself!?
In C, you can call telnet using the following statement: system("telnet ip_addr");
Or you can use exec() to do the same.
Hope I answered your question....