Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

StreamPeerUDS

继承: StreamPeerSocket < StreamPeer < RefCounted < Object

处理 UNIX 域套接字 (UDS) 连接的流对等端。

描述

处理 UNIX 域套接字 (UDS) 连接的流对等端。该对象可用于连接 UDS 服务器,也可由 UDS 服务器返回。Unix 域套接字使用文件系统命名空间在同一台机器上提供进程间通信。

注意:UNIX 域套接字仅在类 UNIX 系统(Linux、macOS 等)上可用,Windows 系统上不受支持。

方法

Error

bind(path: String)

Error

connect_to_host(path: String)

String

get_connected_path() const


方法说明

Error bind(path: String) 🔗

打开 UDS 套接字,并将其绑定到指定的套接字路径。

通常不需要该方法,它仅用于强制后续调用 connect_to_host() 时使用指定的 path 作为源地址。


Error connect_to_host(path: String) 🔗

连接到指定的 UNIX 域套接字路径。成功时返回 @GlobalScope.OK


String get_connected_path() const 🔗

返回该对等端的套接字路径。