无法使用带有 DCE 管道的异步 RPC 将数据推送到服务器

Posted

技术标签:

【中文标题】无法使用带有 DCE 管道的异步 RPC 将数据推送到服务器【英文标题】:Unable to push data to server using Asynchronous RPC with DCE pipes 【发布时间】:2015-04-16 04:12:04 【问题描述】:

我想使用带有管道的异步 RPC 将数据推送到服务器。这是我的代码:

//file: Xasyncpipe.idl:   
interface IMyAsyncPipe

//define the pipe type
typedef pipe int ASYNC_INTPIPE;

int MyAsyncInputPipe(
    handle_t hBinding, 
    [in] ASYNC_INTPIPE *inpipe) ;
;



//file:Xasyncpipe.acf:
interface IMyAsyncPipe

[async] MyAsyncInputPipe () ;
 ;



//file:Client.cpp
mian()

// Creates a binding handle.
...
RPC_ASYNC_STATE Async;
status = RpcAsyncInitializeHandle(&Async, sizeof(RPC_ASYNC_STATE));
Async.UserInfo = NULL;
Async.NotificationType = RpcNotificationTypeIoc;
Async.u.IOC.hIOPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
ASYNC_INTPIPE inputPipe;

// Calls the RPC function.
MyAsyncInputPipe(&Async, hBinding, &inputPipe);




//file:Server.cpp
void MyAsyncInputPipe(PRPC_ASYNC_STATE state, handle_t hBinding, ASYNC_INTPIPE *pipe)

std::cout << "Input Test" << std::endl;

我在函数 MyAsyncInputPipe 中添加了一个断点,并且断点从未被触发。

我将 Xasyncpipe.idl 从[in] ASYNC_INTPIPE *inpipe 更改为[out] ASYNC_INTPIPE *inpipe,触发断点。

有人知道原因吗?

【问题讨论】:

【参考方案1】:

在客户端管道推送终端信号之前,服务器不会接收数据。

//push terminal signal    
inputPipe.push(inputPipe.state, NULL, 0);

【讨论】:

以上是关于无法使用带有 DCE 管道的异步 RPC 将数据推送到服务器的主要内容,如果未能解决你的问题,请参考以下文章

Ionic 4 Angular模板与异步管道绑定到可观察

无法弄清楚如何将数据异步推送到数组

带有 ngSwitch 的条件按钮也带有来自异步管道数组的 ngFor

带有 HTTP 回调的异步 RPC

带有 ChangeDetectionStrategy.OnPush 和异步管道的 Angular 2 Observable 不起作用

Jenkins 管道无法使用凭据推送到 gerrit