469,631 Members | 976 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

very urgent

I have already tried this URL's code
but I am getting error when i am creating a UDP type Socket and recieving
packet from this socket.
some time error is---"An existing connection was forcibly closed by the
remote host"
and some time error is---
"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"
i am using this code for



IPHostEntry ihe = Dns.GetHostEntry(host);

IPEndPoint iep = new IPEndPoint(ihe.AddressList[0], 161);

EndPoint ep = (EndPoint)iep;

Socket sock = new Socket(ep.AddressFamily, SocketType.Dgram,
SocketOptionName.ReceiveTimeout, 1000);

sock.SendTo(packet, snmplen, SocketFlags.None, iep);

//Receive response from packet



packet = new byte[1024];

int recv = sock.ReceiveFrom(packet, ref ep);
//here I am getting above written exceptions

catch (SocketException ex)


packet[0] = 0xff;


pls help me out of this its very urgent.
alok sengar

Jun 8 '06 #1
1 1652
>pls help me out of this its very urgent.

Just a quick tip. Next time you have an urgent question, try posting
with a subject that describes the problem. It tends to attract the
right people better than a generic "very urgent" subject.

Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jun 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by samir dsf | last post: by
33 posts views Thread by dembla | last post: by
3 posts views Thread by N. Spiker | last post: by
3 posts views Thread by settyv | last post: by
1 post views Thread by rajesh.us.it.recruiter | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.