> ## 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.

# XGameStreamingGetConnectionState

> XGameStreamingGetConnectionState

# XGameStreamingGetConnectionState

获取指定设备的当前连接状态。

## 语法

```cpp theme={null}
XGameStreamingConnectionState XGameStreamingGetConnectionState(  
         XGameStreamingClientId client  
)  
```

### 参数

*client*   \_In\_\
类型：XGameStreamingClientId

要请求其连接状态的客户端。

### 返回值

类型：[XGameStreamingConnectionState](/reference/system/xgamestreaming/enums/xgamestreamingconnectionstate)

## 备注

此 API 返回指定客户端的 [XGameStreamingConnectionState](/reference/system/xgamestreaming/enums/xgamestreamingconnectionstate)。这允许检查自游戏上次检查以来设备是否已断开连接。

如果游戏仅尝试识别是否有任何设备已连接并进行流式处理，请考虑使用 [XGameStreamingIsStreaming](/reference/system/xgamestreaming/functions/xgamestreamingisstreaming)。

如果游戏需要在流式处理客户端连接和/或断开连接时收到通知，请考虑使用 [XGameStreamingRegisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged)

## 要求

**标头：** xgamestreaming.h

**库：** xgameruntime.lib

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

## 另请参阅

[XGameStreamingIsStreaming](/reference/system/xgamestreaming/functions/xgamestreamingisstreaming)\
[XGameStreamingRegisterConnectionStateChanged](/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged)\
[XGameStreamingGetClientCount](/reference/system/xgamestreaming/functions/xgamestreaminggetclientcount)\
[XGameStreamingGetClients](/reference/system/xgamestreaming/functions/xgamestreaminggetclients)\
[XGameStreaming](/reference/system/xgamestreaming/xgamestreaming_members)


## Related topics

- [XGameStreaming](/zh-CN/reference/system/xgamestreaming/xgamestreaming_members.md)
- [面向 GDK 的 Unity C# API 包装器](/zh-CN/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XGameStreamingConnectionState](/zh-CN/reference/system/xgamestreaming/enums/xgamestreamingconnectionstate.md)
- [XGameStreamingConnectionStateChangedCallback](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingconnectionstatechangedcallback.md)
- [XGameStreamingRegisterConnectionStateChanged](/zh-CN/reference/system/xgamestreaming/functions/xgamestreamingregisterconnectionstatechanged.md)
