Possible errors in telnet


 
Thread Tools Search this Thread
Operating Systems Linux Possible errors in telnet
# 1  
Old 09-24-2009
Possible errors in telnet

Am writing one script in which it will check whether a device listens on the specific port. using telnet, I have written the script.
Now my doubt is I have to handle different kind of errors that telnet is giving.
Anybody can give the list of errors and what is the cause of that error?
So that I can handle accordingly in my script?

Its appreciable, If you provide any useful URL.
# 2  
Old 09-24-2009
Java my expect script

script called with two parameters host and port

Code:
#!/usr/bin/expect -f
set timeout 3
set HOST [lindex $argv 0]
set PORT [lindex $argv 1]
#$spawn -noecho $env(SHELL)
spawn -noecho "/bin/bash"
send "telnet ${HOST} ${PORT}\r"
expect {
    "Unknown host"
{
 puts "Unknown Host"
exit 1
}

    "Unable to connect" 
    { 
        puts "not connecting" 
        exit 1
    } 
    "Connected to " 
    {
        send -- "\r"
            expect "telnet>"
            send -- "quit\r"
            expect "Connection closed"
            puts "Connecting "
            exit 0
    }
}
send -- ""
exit 1

# 3  
Old 09-24-2009
@chakrapani,

Thanks for your reply.

But I am not expecting the script.

I want list of possible errors in telnet like

Connection refused - no device to listen on given port.
No route to host - Machine may not be reachable / invalid ip.

some thing like this...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Telnet errors coming on screen while using snarf command.

Hi Team, I am using one script, It is working fine, the problem is it gives unwanted telnet errors when I am using it. I just want to remove these unwanted errors/info from my screen. bash-3.00$ cat raza_site_temp #!/usr/bin/bash #rj835b IFS="|" REGEX="$*" echo snarf2 -c "show... (1 Reply)
Discussion started by: Raza Ali
1 Replies

2. UNIX for Dummies Questions & Answers

Difference Between Krb5-telnet And Ekrb5-telnet

Hi, I want to know the difference between these two services. Both are under xinetd. Both are used for enabling and disabling Telnet service. So, can somebody please explain me the difference between the two ? Thanks in advance :) (0 Replies)
Discussion started by: kashifsd17
0 Replies

3. UNIX for Dummies Questions & Answers

Automatically login in the telnet from present telnet

Hi, I was writing one script which includes to switch to the another telnet automatically from the present telnet server. I was using rlogin but firstly it takes the same user name of the present telnet and secondly it is prompting for the password. But i want to switch to the another telnet... (2 Replies)
Discussion started by: Prateek
2 Replies

4. HP-UX

telnet remsh rogin errors

hi everybody. can u help please . i have error: getpid: peer died: Error 0 on /var/adm/syslog/syslog.log. what does it means?how can i fix problem? also strange wen i make an rlogin from my affected host to annother one. it demands the password!!!! (0 Replies)
Discussion started by: hmaiida
0 Replies

5. Shell Programming and Scripting

Webpage to Telnet via Perl and Expect: Telnet problem?

Somewhat long story: I have a simple Perl CGI script that uses Expect to Telnet to a device and grab some data, and then spits it back to Perl for display on the Webpage. This works for many devices I've tried, but one device just fails, it keeps rejecting the password on this device, only... (1 Reply)
Discussion started by: jondo
1 Replies

6. UNIX for Dummies Questions & Answers

Major OS errors/Bash errors help!!!!

Hi all, dummy here.... I have major errors on entering the shell. On login I get: -bash: dircolors: command not found -bash: tr: command not found -bash: fgrep: command not found -bash: grep: command not found -bash: grep: command not found -bash: id: command not found -bash: [: =: unary... (12 Replies)
Discussion started by: wcmmlynn
12 Replies

7. Programming

errors....

hi i have written a program to display files in a directory but it doesnt compile on the sun/solaris system.... im using gcc(inbuilt compiler) im generally used to working on a windows environment so maybe im overlookiing something ive added comments to help readability of the program i also... (2 Replies)
Discussion started by: anything2
2 Replies

8. AIX

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (2 Replies)
Discussion started by: mcastill66
2 Replies

9. UNIX for Advanced & Expert Users

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (0 Replies)
Discussion started by: mcastill66
0 Replies

10. Filesystems, Disks and Memory

Help with errors

I am very new to the world of Unix, in the middle of a crash course as I write this due to a system failure for my company. This system went down approximately 24 hours ago due to some apparent thunderstorms that passed through. The problem is that my company, like many others, has laid off... (5 Replies)
Discussion started by: Phaedirean
5 Replies
Login or Register to Ask a Question