> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XGameStreamingGetServerLocationName

> XGameStreamingGetServerLocationName

# XGameStreamingGetServerLocationName

获取流式处理服务器数据中心位置的名称。

<a id="syntaxSection" />

## 语法

```cpp theme={null}
HRESULT XGameStreamingGetServerLocationName(
         size_t serverLocationNameSize,
         char* serverLocationName
)
```

<a id="parametersSection" />

### 参数

*serverLocationNameSize*   \_In\_\
类型：size\_t

要返回的数据中心位置名称的最大大小。
应通过调用 [XGameStreamingGetServerLocationNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize) 检索 `serverLocationNameSize`。

*serverLocationName*   \_Out\_writes\_z\_(serverLocationNameSize)\
类型：char\*

托管流式处理 XBOX 服务器的数据中心所在的 Azure 区域的名称。

<a id="retvalSection" />

### 返回值

类型：HRESULT

如果成功，则返回 **S\_OK**；否则返回错误代码。

**潜在错误**

| 错误代码                               | 错误值        | 错误原因                                                                                                                                       |
| ---------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| E\_GAMESTREAMING\_NOT\_INITIALIZED | 0x89245400 | XGameStreaming 运行时尚未初始化。在调用其他 API 之前，请先调用 [XGameStreamingInitialize](/reference/system/xgamestreaming/functions/xgamestreaminginitialize)。 |
| E\_NOT\_SUFFICIENT\_BUFFER         | 0x7A       | *serverLocationSize* 不够大，无法容纳服务器位置的完整名称（及其终止 null 字符）。                                                                                     |
| E\_GAMESTREAMING\_NO\_DATACENTER   | 0x89245403 | 当前计算机未在数据中心运行。                                                                                                                             |

有关错误代码列表，请参阅[错误代码](/reference/errorcodes)。

<a id="remarksSection" />

## 备注

在调用此函数之前，可以调用 [XGameStreamingGetServerLocationNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize) 来获取服务器位置名称的大小，以便可以分配缓冲区。

如果游戏想要连接到托管在 Azure PlayFab 多人游戏服务器上的游戏服务器，并且想要与其游戏服务器实现最小延迟，则可以使用 Azure 区域。

当玩家使用主机流式处理从家用 XBOX 流式播放游戏时，可能会发生 `E_GAMESTREAMING_NO_DATACENTER` 错误。如果尚未设置替代值，此错误也可能在 XBOX 开发者工具包上发生。

在 XBOX 开发者工具包上，可以在 **Developer Home** 的**流式处理**选项卡中设置测试期间应返回的 `serverLocationName`。

<a id="requirementsSection" />

## 要求

**标头：** xgamestreaming.h

**库：** xgameruntime.lib

**支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

<a id="seealsoSection" />

## 另请参阅

[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)\
[XGameStreamingGetServerLocationNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize)


## Related topics

- [XGameStreamingGetServerLocationNameSize](/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize.md)
- [XGameStreaming](/zh-CN/reference/system/xgamestreaming/xgamestreaming_members.md)
- [针对 XBOX 游戏串流优化您的游戏](/zh-CN/build/core-features/common/game-streaming/game-streaming-optimizing-your-game.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XGameStreamingGetTouchBundleVersionNameSize](/zh-CN/reference/system/xgamestreaming/functions/xgamestreaminggettouchbundleversionnamesize.md)
