Skip to contentSkip to conversation

Telnet issues

DISCUSSION ibraheem umaru-mohammed 2 participants 3 messages Jul 26, 2002 – Jul 29, 2002

lore
Share & tools
lore
#0 lore raw

This is a shot in the dark...am having some *solaris* issues and was just hoping someone might spot something that i am missing...

Basically, telnet seems to work differently when given an IP address to when it is given a hostname?

Basically, we have a problem where we attempt to spawn a shell to start xterm with telnet as the command...when a hostname is specified, telnet establishes contact, but for some reason is started up in SINGLE_CHARACTER_MODE. When an IP address is specified, telnet is started in LINE_MODE.

We get the following when started in SINGLE_CHARACTER_MODE:

			--cut here--
Trying 193.131.98.222...
Connected to springfield.
Escape character is '^]'.
			--cut here--

And it just hangs there. The command we are trying to issue in C is:

execl("/bin/sh", "sh", "-c", "xterm -e /bin/sh -c 'telnet springfield'", (char *)0);

Anyone have any ideas?

Kindest regards,

			--ibs.
Signature · 3 lines
			ibraheem umaru-mohammed
			   www.micromuse.com
			         --0--
#1 lore raw
Quoted 5 lines

This is a shot in the dark...am having some *solaris* issues and was just hoping someone might spot something that i am missing...
...
execl("/bin/sh", "sh", "-c", "xterm -e /bin/sh -c 'telnet springfield'", (char *)0);

Hmm... Well, one thing I can see is.. why invoke a shell in xterm to invoke telnet? Here's what I just tried, and it seems to work (sparc:solaris 8):

execl("/bin/sh", "sh", "-c", "/usr/openwin/bin/xterm -e telnet www", (char *)0); execl("/bin/sh", "sh", "-c", "/usr/openwin/bin/xterm -e telnet (ipnumber)", (char *)0); execl("/bin/sh", "sh", "-c", "xterm -e telnet (ipnumber)", (char *)0);

and it all works for both the name and an ip number...

So possibly your problem is the extra shell you're invoking.

Ciao!

Jason

Signature · 5 lines
|EMAIL [email protected]                        Who wills, Can.
|VOICE (408) 243-3425                         Who tries, Does.
|LOCAL Hey, Jason!                              Who loves, Lives.          o_.
|Disclaimer:  Not me! I didn't do *THAT!*                                 <|
|Local Disclaimer:  I'm not here!                   A. McCaffrey           4
#2 lore raw

[Jason P. Winters wrote...]

-|  
-| > This is a shot in the dark...am having some *solaris* issues and was
-| > just hoping someone might spot something that i am missing...
-| > ...
-| > execl("/bin/sh", "sh", "-c", "xterm -e /bin/sh -c 'telnet springfield'", (char *)0);
-| 
-| Hmm... Well, one thing I can see is.. why invoke a shell in xterm to
-| invoke telnet?  Here's what I just tried, and it seems to work (sparc:solaris 8):
-| 
-| execl("/bin/sh", "sh", "-c", "/usr/openwin/bin/xterm -e telnet www", (char *)0);
-| execl("/bin/sh", "sh", "-c", "/usr/openwin/bin/xterm -e telnet (ipnumber)", (char *)0);
-| execl("/bin/sh", "sh", "-c", "xterm -e telnet (ipnumber)", (char *)0);
-| 
-| and it all works for both the name and an ip number...  
-| 
-| So possibly your problem is the extra shell you're invoking.
-| 
-| Ciao!
-| 
-| Jason
-| 

Thanks for responding. Problem was very weird and interesting.

Firstly, the reason why we were invoking a shell in xterm had to do with some of the environment variables we were passing through, such as the location of xterm, the telnet host etc.

Initially, I thought it was some sort of name resolving issue (NIS or something)...having played around with some message catalogs , I found I could get the telnet to fork successfully if I didn't open all the message catalogs. I couldn't figure it out - was it a name resolving issue or a locale problem? Hmmn...

Hours later, a colleague later found that I was forking without closing copied file descriptors...we added a for loop to close all open file descriptors in the range 0 - MAX_INT...and it worked. No issues at all now strangely enough.

Any one have any ideas why this should be platform (solaris) specific issue, and why i didn't get some sort of proper error? Even so, it seems strange that that should be the solution to the problem.

Kindest regards,

			--ibs.
Signature · 3 lines
			ibraheem umaru-mohammed
			   www.micromuse.com
			         --0--