2010-12-09 33 views
2

我有一个d-link dp-311p打印服务器,它在其接口上提供打印机状态(脱机,出纸等)。 我怎样才能得到这个oid状态?我试图通过axence nettools找到,但有很多的键和说明不友好... 此外,我试图用this代码(C#)来访问打印服务器的状态,但没有成功..请,需要一盏灯,我完全失去了! Tks everyone在我的d-link打印服务器上查询打印机状态

回答

2

我做到了!这里是: 搜索mib浏览器,因为我不知道打印服务器状态的oid。发现This one,然后,我创造了这样

OLEPRNLib.SNMP snmp = new OLEPRNLib.SNMP(); 
int Retries = 1; 
int TimeoutInMS = 2000; 
string CommunityString = "public"; 
string IPAddressOfPrinter = "192.168.1.12"; 
string ALLINEED; 

// Open the SNMP connect to the print server 
snmp.Open(IPAddressOfPrinter, CommunityString, Retries, TimeoutInMS); 
ALLINEED = snmp.Get(".1.3.6.1.4.1.11.2.3.9.1.1.3.0"); 
snmp.Close(); 

Console.Write(ALLINEED); 

一个控制台应用程序在我的机器我做这些住在“C添加引用对话框以“oleprn 1.0类型库”的COM选项卡上的引用:\ Windows下\ System32 \ oleprn.dll“

希望这可以帮助某人。

Tks

+0

干得好!您应该能够将其标记为答案。 – 2010-12-10 14:49:05