Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi,
 
I found an excellent telnet client which works perfectly [Quick tool : A minimalistic Telnet library], through code project Smile | :) .
 
But the server that I'm using doesn't prompt the login, else i have to supply the login name once the telnet client being connected to the server. In this case a slight modification should be done to the above coding.
 
I tried to modify the coding accordingly, but failed. Can somebody help me to find the solution please?
 
I am using the same solution given here "Quick tool : A minimalistic Telnet library"
 
Thanks & Regards,
Hansika
Posted 16-Nov-11 4:28am
Edited 16-Nov-11 4:30am
RaisKazi32.4K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Do you mean that once you've connected, the server says nothing and you are expected to send your login info without being prompted?
 
Just looking at the code, if this is the case, just remove the read instructions and use the WriteLines.
 
string s = Read(); // not needed as its not sending anything
  Permalink  
Comments
hansika attanayake at 18-Nov-11 3:06am
   
thanks, ya i have to send the username only. After entering the username a password prompt is appearing.
i changed the codings accordingly, but it doesnt prompt for the password :(
i modofied the coding as given below:
 
public string Login(string Username,string Password,int LoginTimeOutMs)
{
int oldTimeOutMs = TimeOutMs;
TimeOutMs = LoginTimeOutMs;
Console.WriteLine(Username);
string s = Read();
if (!s.TrimEnd().EndsWith(":"))
throw new Exception("Failed to connect : no password prompt");
WriteLine(Password);
 
s += Read();
TimeOutMs = oldTimeOutMs;
return s;
}
 
pls help
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Some telnet servers only support connections from known IP addresses. For other clients, they either refuse connection or to confuse the client, accept the connection and then does nothing (no data is accepted or sent back). It's a possibility that this is what you are experiencing here.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 459
1 Maciej Los 404
2 Sergey Alexandrovich Kryukov 192
3 CPallini 185
4 Hard_Rockz 115
0 OriginalGriff 5,634
1 Sergey Alexandrovich Kryukov 4,763
2 Peter Leow 2,954
3 Maciej Los 2,614
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web01 | 2.8.140718.1 | Last Updated 16 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid