Since you were very lacking with actual details, I can only guess.
I could be the case that you are suffering from some sort of network timeout.
For example I have seen the following occur...
would take 30 seconds before it would succeed.
The problem was that the the primary DNS server I was "using" was down.
Telnet would ask it to resolve the host name; which would time out.
The telnet would ask the secondary DNS server & succeed.
The 30 second delay was due to the DNS timeout upon initial hostname lookup.