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

Serialization Services

· 52CE 我爱测

Microsoft RPC supports two methods for encoding and decoding data, collectively called serializing data.

Microsoft RPC supports two methods for encoding and decoding data, collectively called serializing data. Serialization means that the data is marshaled to and unmarshaled from buffers that you control. This differs from the traditional usage of RPC, in which the stubs and the RPC run-time library have full control of the marshaling buffers, and the process is transparent. You can use the buffer for storage on permanent media, encryption, and so on. When you encode data, the RPC stubs marshal the data to a buffer and pass the buffer to you. When you decode data, you supply a marshaling buffer with data in it, and the data is unmarshaled from the buffer to memory. You can serialize on a procedure or type basis.

Note:
The term pickling is commonly used among developers to describe serialization. In fact, the Windows SDK samples contains a directory called pickle that preserves the RPC serialization sample programs.

Serialization leverages the RPC mechanisms for marshaling and unmarshaling data for other purposes. For example, instead of using several I/O operations to serialize a group of objects to a stream, an application can optimize performance by serializing several objects of different types into a buffer and then writing the entire buffer in a single operation. The functions that manipulate serialization handles are independent of the type of serialization you are using.

As another example, if you need to use a network transport mechanism besides RPC, such as Microsoft Windows Sockets (Winsock). With RPC serialization, your program can make calls to functions that marshal your data into buffers and then transmit this data using Winsock. When your application receives data, it can use the RPC serialization mechanism to unmarshal data from buffers filled by the Winsock routines. This provides you with many of the advantages of RPC-style applications, and at the same time, it enables you to use non-RPC transport mechanisms.

You can also use serialization for purposes unrelated to network communications. For example, once you use the RPC encoding functions to marshal data to a buffer, you can store it in a file for use by another application. You can also encrypt it. You can even use it to store a hardware- and operating system-independent representation of data in a database.

The following topics present a discussion of the serialization services that Microsoft RPC supports:

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)

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

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