المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Problem with connection to Socket



C# Programming
01-21-2010, 07:30 PM
Hi

I need to validate the email addresses to check if they are existing or not.
I used the following code to check first for the validation of domain but it failed with the following exception : A connection attempt failed because the connected party did not properly respond after a certain period of time, or established connection failed because conencted host has failed to respond 209.85.135.17:25

Here I used 25 port but is that port valid or i have to use someother port.

string address = "test@g.com";
string[] host = (address.Split('@'));
string hostname = host[1];

IPHostEntry IPhst = Dns.Resolve(hostname);
IPEndPoint endPt = new IPEndPoint(IPhst.AddressList[0], 25);
Socket s= new Socket(endPt.AddressFamily,
SocketType.Stream,ProtocolType.Tcp);
s.Connect(endPt);


Can anyone please help me. Any Ideas please!! I need it urgently.

Thanks in advance,

--
http://ashakthi.blogspot.com
http://kids-articles.blogspot.com