大网数据广告活动
网络与域名解析

Implementing Input Pipes on the Server

· 52CE 我爱测

To begin sending data to a server, a client calls one of the server's remote procedures.

To begin sending data to a server, a client calls one of the server's remote procedures. This procedure must repeatedly call the pull procedure in the server's stub. The MIDL compiler uses the application's IDL file to automatically generate the server's pull procedure.

Each time the server program invokes the pull procedure in its stub, the pull procedure receives blocks of data from the client. It unmarshals the data into the server's buffer. The server's remote procedure can then process this data in any way required. The loop continues until the server receives a buffer of zero length.

The following example is from the Pipedemo program contained in the samples that come with the Platform Software Development Kit (SDK). It illustrates a remote server procedure that uses a pipe to pull data from the client to the server.

//file: server.c (fragment)
#include uc_server.c
#define PIPE_TRANSFER_SIZE 100 /* Transfer 100 pipe elements at one time */
 
void InPipe(LONG_PIPE     long_pipe )
{
    long local_pipe_buf[PIPE_TRANSFER_SIZE];
    ulong actual_transfer_count = PIPE_TRANSFER_SIZE;
 
    while(actual_transfer_count > 0) /* Loop to get all 
                                        the pipe data elements */
    {
        long_pipe.pull( long_pipe.state,
                        local_pipe_buf,
                        PIPE_TRANSFER_SIZE,
                        &actual_transfer_count);
        /* process the elements */
    } // end while
} //end InPipe

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。