> ## 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](/zh-TW/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 執行階段尚未初始化。請先呼叫 [XGameStreamingInitialize](/zh-TW/reference/system/xgamestreaming/functions/xgamestreaminginitialize)，再呼叫其他 API。 |
| E\_NOT\_SUFFICIENT\_BUFFER | 0x7A | *serverLocationSize* 不夠大，無法容納伺服器位置的完整名稱 (及其結尾的 null 字元)。 |
| E\_GAMESTREAMING\_NO\_DATACENTER | 0x89245403 | 目前的電腦並未在資料中心內執行。 |

如需錯誤碼清單，請參閱[錯誤碼](/zh-TW/reference/errorcodes)。

<a id="remarksSection" />

## 備註

呼叫此函式之前，您可以先呼叫 [XGameStreamingGetServerLocationNameSize](/zh-TW/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize) 以取得伺服器位置名稱的大小，以便配置緩衝區。

如果遊戲想要連線至裝載於 Azure PlayFab Multiplayer Servers 上的遊戲伺服器，並希望與其遊戲伺服器之間的延遲降到最低，您可以利用 Azure 區域。

當玩家使用主機串流從家中的 XBOX 串流遊戲時，可能會發生 `E_GAMESTREAMING_NO_DATACENTER` 錯誤。如果您尚未設定覆寫值，此錯誤也可能發生在 XBOX 開發套件上。

在 XBOX 開發套件上，您可以在 **Developer Home** 的 **Streaming** 索引標籤中，設定測試期間應傳回的 `serverLocationName`。

<a id="requirementsSection" />

## 需求

**標頭：** xgamestreaming.h

**程式庫：** xgameruntime.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

<a id="seealsoSection" />

## 另請參閱

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


## Related topics

- [XGameStreamingGetServerLocationName](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationname.md)
- [XGameStreamingGetServerLocationNameSize](/reference/system/xgamestreaming/functions/xgamestreaminggetserverlocationnamesize.md)
