Click here to Skip to main content
13,148,503 members (57,866 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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,
Posted 16-Nov-11 4:28am
Updated 13-Feb-17 21:53pm
Rate this: bad
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
hansika attanayake 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;
string s = Read();
if (!s.TrimEnd().EndsWith(":"))
throw new Exception("Failed to connect : no password prompt");

s += Read();
TimeOutMs = oldTimeOutMs;
return s;

pls help
Rate this: bad
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 14 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100