本文整理汇总了Java中jcifs.dcerpc.msrpc.MsrpcShareEnum类的典型用法代码示例。如果您正苦于以下问题:Java MsrpcShareEnum类的具体用法?Java MsrpcShareEnum怎么用?Java MsrpcShareEnum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MsrpcShareEnum类属于jcifs.dcerpc.msrpc包,在下文中一共展示了MsrpcShareEnum类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doMsrpcShareEnum
import jcifs.dcerpc.msrpc.MsrpcShareEnum; //导入依赖的package包/类
static FileEntry[] doMsrpcShareEnum ( CIFSContext ctx, String host, Address address ) throws IOException {
MsrpcShareEnum rpc = new MsrpcShareEnum(host);
/*
* JCIFS will build a composite list of shares if the target host has
* multiple IP addresses such as when domain-based DFS is in play. Because
* of this, to ensure that we query each IP individually without re-resolving
* the hostname and getting a different IP, we must use the current addresses
* IP rather than just url.getHost() like we were using prior to 1.2.16.
*/
try ( DcerpcHandle handle = DcerpcHandle.getHandle("ncacn_np:" + address.getHostAddress() + "[\\PIPE\\srvsvc]", ctx) ) {
handle.sendrecv(rpc);
if ( rpc.retval != 0 )
throw new SmbException(rpc.retval, true);
return rpc.getEntries();
}
}
示例2: testSRVS
import jcifs.dcerpc.msrpc.MsrpcShareEnum; //导入依赖的package包/类
@Test
public void testSRVS () throws DcerpcException, IOException {
try ( DcerpcHandle handle = DcerpcHandle
.getHandle("ncacn_np:" + getTestServer() + "[\\PIPE\\srvsvc]", withTestNTLMCredentials(getContext())) ) {
MsrpcShareEnum rpc = new MsrpcShareEnum(handle.getServerWithDfs());
handle.sendrecv(rpc);
assertEquals(0, rpc.retval);
}
}
示例3: exclusiveConnection
import jcifs.dcerpc.msrpc.MsrpcShareEnum; //导入依赖的package包/类
@Test
public void exclusiveConnection () throws IOException {
try ( DcerpcHandle handle = DcerpcHandle
.getHandle("ncacn_np:" + getTestServer() + "[\\PIPE\\srvsvc]", withTestNTLMCredentials(getContext()), true) ) {
MsrpcShareEnum rpc = new MsrpcShareEnum(handle.getServerWithDfs());
handle.sendrecv(rpc);
assertEquals(0, rpc.retval);
}
}