2
Encoding en = Encoding.GetEncoding("iso-8859-1"); // default encoding
IPHostEntry IPhst = Dns.GetHostEntry(_Host);
IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
Socket s = new Socket(endPt.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
s.Connect(endPt);

Here am getting the error like:

System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 202.88.253.162:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)"

How i can solve this?

1
  • Does telnet 202.88.253.162 25 connect to the remote host? Commented Jun 14, 2011 at 12:56

2 Answers 2

3

The is no server listening at specified ip/port that you are trying to connect to.

Possible causes for the error:

  1. You are using the wrong IP address
  2. You are using the wrong port

Update

Didn't see that you are trying to connect to a SMTP server. Many ISP:s block port 25 for all ip addresses except their own SMTP servers. It's to reduce SPAM emails. So that could be the cause too.

Sign up to request clarification or add additional context in comments.

Comments

0

Try using the IP 127.0.0.1 . It might work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.