I have already tried this URL's code
"http://www.java2s.com/Code/CSharp/Network/SimpleSNMP.htm"
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
try
{
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,
ProtocolType.Udp);
sock.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, 1000);
sock.Connect(iep);
sock.SendTo(packet, snmplen, SocketFlags.None, iep);
//Receive response from packet
try
{
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.
thanks
alok sengar
"Greg Young" <dr*******************@hotmail.com> wrote in message
news:Of**************@TK2MSFTNGP05.phx.gbl...
There are numerous open source libraries ...Might be beneficial to look
through some already working code (or just use one as is as opposed to
making another wheel :)).
check out
http://www.c-sharpcorner.com/Code/2002/Sept/SnmpLib.asp
http://www.java2s.com/Code/CSharp/Ne...SimpleSNMP.htm
http://net-snmp.sourceforge.net/
Cheers,
Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"alok sengar" <al*********@suviinfo.com> wrote in message
news:O4**************@TK2MSFTNGP02.phx.gbl...hi sir/mam,
I am facing problem when i am developing a application to
implement SNMP protocol using C#.net
can u tell me how can i implement SNMP protocol in .net
please reply me soon
thanks
alok sengar