Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I found an excellent telnet client which works perfectly [Quick tool : A minimalistic Telnet library], through code project :).

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
Updated 13-Feb-17 21:53pm
v2

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
 
Share this answer
 
Comments
hansikaat 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
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900