NetworkUtils
public class NetworkUtils
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:32–153Network Utils,支持智能体之间的发现、委派与协作。位于 io.agentscope.runtime.protocol.a2a 包。核心成员包括 getServerIpAddress、getServerPort、getServerUrl、getConfigInfo、NetworkUtils。
Network utility class for getting current server IP address and port configuration
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public NetworkUtils(DeployProperties serverConfig) | 初始化 `NetworkUtils` 实例。 Creates a new instance. |
public NetworkUtils(int serverPort, String serverAddress) | 初始化 `NetworkUtils` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getServerIpAddress() | 获取 `getServerIpAddress`。 Get current server IP address
Uses address from configuration, or auto-detects local IP if not configured |
public int getServerPort() | 获取 `getServerPort`。 Get server port |
public String getServerUrl(String path) | 获取服务端 URL。 Get complete server URL |
public String getConfigInfo() | 获取配置信息。 Get configuration information (for debugging) |
构造器详情Constructor Detail
NetworkUtils
public NetworkUtils(DeployProperties serverConfig)
初始化 NetworkUtils 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
serverConfig | DeployProperties | 服务端配置(类型 `DeployProperties`)。The server config. |
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:37–40NetworkUtils
public NetworkUtils(int serverPort, String serverAddress)
初始化 NetworkUtils 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
serverPort | int | 服务端 Port(类型 `int`)。The server port. |
serverAddress | String | 服务端 Address(类型 `String`)。The server address. |
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:42–45方法详情Method Detail
getServerIpAddress
public String getServerIpAddress()
获取 getServerIpAddress。
Get current server IP address Uses address from configuration, or auto-detects local IP if not configured
String返回字符串结果。server IP address
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:53–66getServerPort
public int getServerPort()
获取 getServerPort。
Get server port
int返回数值结果。server port
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:73–75getServerUrl
public String getServerUrl(String path)
获取服务端 URL。
Get complete server URL
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。path (optional) |
String返回字符串结果。complete server URL
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:83–93getConfigInfo
public String getConfigInfo()
获取配置信息。
Get configuration information (for debugging)
String返回字符串结果。configuration information string
源码Source
io/agentscope/runtime/protocol/a2a/NetworkUtils.java:100–108