I'm new to monodevelop and csharp litle experience in the past.
Trying to do this example: http://sharpsnmplib.codeplex.com/wikipage?title=600009&referringTitle=KB
I get and error
TestAsyncGet/Program.cs(32,32): Error CS0246: The type or namespace name `IPEndPoint' could not be found. Are you missing a using directive or an assembly reference? (CS0246) (TestAsyncGet)
Thank you for any help.
Have in references System.Net also is complaining about:
Projects/TestAsyncGet/TestAsyncGet/Program.cs(13,13): Error CS0825: The contextual keyword `var' may only appear within a local variable declaration (CS0825) (TestAsyncGet)
Running from the command line:
mono TestAsyncGet.exe System.FormatException: Input string was not in the correct format at System.Int64.Parse (System.String s) [0x00000] in :0 at TestAsyncGet.Program.Main (System.String[] args) [0x00000] in :0
GetRequestMessage message = new GetRequestMessage(0,
VersionCode.V1,
new OctetString("stvtelco"),
new List<Variable> {new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.4"))});
long ip = Int64.Parse("192.168.0.33");
var endpoint = new IPEndPoint(new IPAddress(ip), 161);
message.BeginGetResponse(endpoint, new UserRegistry(), endpoint.GetSocket(), ar => {
var response = message.EndGetResponse(ar);
Console.WriteLine(response);
}, null);
Console.Read();
IPEndPointshould work as long as you haveusing System.Net;at the top of the file. Is your code exactly as the one in the sample? The other error indicates you also have some syntactic error in your code. - svickInt64.Parse("192.168.0.33")doesn't make any sense. Just useIPAddress.Parse("192.168.0.33")to get theIPAddress. - svick