|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| adapter/ | | 12-May-2024 | - | 15,389 | 11,690 |
| components/ | | 12-May-2024 | - | 68,099 | 50,975 |
| core/ | | 12-May-2024 | - | 141,673 | 116,866 |
| figures/ | | 12-May-2024 | - | | |
| interfaces/ | | 12-May-2024 | - | 3,530 | 1,091 |
| sdk/ | | 12-May-2024 | - | 30,877 | 25,247 |
| tests/ | | 12-May-2024 | - | 164,336 | 115,698 |
| tools/device_info/ | | 12-May-2024 | - | 119 | 98 |
| .clang-format | D | 12-May-2024 | 1.2 KiB | 40 | 37 |
| .gitattributes | D | 12-May-2024 | 631 | 16 | 15 |
| .gitignore | D | 12-May-2024 | 47 | 3 | 2 |
| BUILD.gn | D | 12-May-2024 | 743 | 23 | 20 |
| CODEOWNERS | D | 12-May-2024 | 7.5 KiB | 132 | 114 |
| Kconfig | D | 12-May-2024 | 2.3 KiB | 87 | 74 |
| LICENSE | D | 12-May-2024 | 9.9 KiB | 177 | 150 |
| OAT.xml | D | 12-May-2024 | 4.9 KiB | 75 | 22 |
| README.md | D | 12-May-2024 | 10.8 KiB | 284 | 218 |
| README_zh.md | D | 12-May-2024 | 11.5 KiB | 291 | 225 |
| bundle.json | D | 12-May-2024 | 5.2 KiB | 144 | 143 |
| check_sub_module.py | D | 12-May-2024 | 987 | 34 | 14 |
| config.py | D | 12-May-2024 | 2.3 KiB | 82 | 53 |
| dsoftbus.gni | D | 12-May-2024 | 2.4 KiB | 76 | 67 |
| hisysevent.yaml | D | 12-May-2024 | 30 KiB | 582 | 504 |
README.md
1# DSoftBus
2
3
4## Introduction
5
6DSoftBus implements unified distributed communications between near-field devices and provides APIs for device discovery, connection, networking, and data transmission, regardless of the link type. It provides the following capabilities:
7
8- Device discovery and connection in various communication modes, such as WLAN and Bluetooth.
9- Unified device networking and topology management, and device information provisioning for data transmission.
10- Channel setup for transmitting messages, bytes, streams, and files.
11
12You can use the APIs provided by DSoftBus to implement fast communication between devices without caring about the communication details, which facilitating deployment and running of services across platforms.
13
14## Architecture
15
16
17
18**Figure 1** DSoftBus architecture
19
20## Directory Structure
21
22The DSoftBus directory structure is as follows:
23
24```text
25//foundation/communication/dsoftbus
26├── adapter # Adaptation code
27├── components # Dependent component code
28├── core # Core code
29│ ├── adapter # Adaptation code
30│ ├── authentication # Authentication code
31│ ├── bus_center # Networking code
32│ ├── common # Common code
33│ ├── connection # Connection code
34│ ├── discovery # Discovery code
35│ ├── frame # Framework code
36│ └── transmission # Transmission code
37├── interfaces # External APIs
38├── sdk # Service process code
39│ ├── bus_center # Networking code
40│ ├── discovery # Discovery code
41│ ├── frame # Framework code
42│ └── transmission # Transmission code
43├── tests # Test code
44└── tools # Tool code
45```
46
47## Constraints
48
49- Connections can be set up only between the devices in the same LAN or between near-field devices.
50- Before setting up a connection between two devices, you must bind the devices. For details about the binding process, see the Security subsystem readme file.
51- After data transmission is complete, the service needs to close the session to release resources.
52
53## Usage
54
55### Usage Guidelines
56
57>**NOTE**
58>
59>- The permissions ohos.permission.DISTRIBUTED_DATASYNC and ohos.permission.DISTRIBUTED_SOFTBUS_CENTER are required for remote procedure calls (RPCs) across devices.
60>- To make a mobile phone visible to other devices, choose **Settings** > **Super Device** > **This device** > **Visible to**, and select **All nearby devices**.
61
62**1. Discovery**
63
64- **Publishing process**
65
661. Publish a service of your application.
67
68 ```C
69 // Callback for service publishing.
70 typedef struct {
71 /** Callback used to return the publish result. */
72 void (*OnPublishResult)(int publishId, PublishResult reason);
73 } IPublishCb;
74
75 // Publish a service.
76 int32_t PublishLNN(const char *pkgName, const PublishInfo *info, const IPublishCb *cb);
77 ```
78
792. Unpublish a service of your application.
80
81 ```C
82 // Unpublish a service.
83 int32_t StopPublishLNN(const char *pkgName, int32_t publishId);
84 ```
85
86
87- **Discovery process**
88
891. Discover a device.
90
91 ```C
92 // Callbacks for device discovery.
93 typedef struct {
94 /** Callback invoked when a device is found. */
95 void (*OnDeviceFound)(const DeviceInfo *device);
96 /** Callback invoked to return the device discovery result. */
97 void (*OnDiscoverResult)(int32_t refreshId, RefreshResult reason);
98 } IRefreshCallback;
99
100 // Start device discovery.
101 int32_t RefreshLNN(const char *pkgName, const SubscribeInfo *info, const IRefreshCallback *cb);
102 ```
103
1042. DSoftBus notifies the service of the device information via the callback once a device is found.
1053. Stop device discovery.
106
107 ```C
108 // Stop the discovery.
109 int32_t StopRefreshLNN(const char *pkgName, int32_t refreshId);
110 ```
111
112**2. Networking**
113
1141. Initiate a connection request with the address of the target device and the connection callback.
115
116 ```C
117 // Address to connect to.
118 typedef struct {
119 ConnectionAddrType type;
120 union {
121 struct BrAddr {
122 char brMac[BT_MAC_LEN];
123 } br;
124 struct BleAddr {
125 char bleMac[BT_MAC_LEN];
126 uint8_t udidHash[UDID_HASH_LEN];
127 } ble;
128 struct IpAddr {
129 char ip[IP_STR_MAX_LEN];
130 uint16_t port;
131 } ip;
132 } info;
133 char peerUid[MAX_ACCOUNT_HASH_LEN];
134 } ConnectionAddr;
135
136 // Address type.
137 typedef enum {
138 CONNECTION_ADDR_WLAN = 0,
139 CONNECTION_ADDR_BR,
140 CONNECTION_ADDR_BLE,
141 CONNECTION_ADDR_ETH,
142 CONNECTION_ADDR_MAX
143 } ConnectionAddrType;
144
145 // Callback invoked to return the connection result.
146 typedef void (*OnJoinLNNResult)(ConnectionAddr *addr, const char *networkId, int32_t retCode);
147
148 // Initiate a connection request.
149 int32_t JoinLNN(const char *pkgName, ConnectionAddr *target, OnJoinLNNResult cb);
150 ```
151
1522. Wait for the connection result. If DSoftBus accepts the connection request, a callback is invoked to return the result. In the return value, if **retCode** is **0**, the connection is successful, and the **addr** parameter matches the **target** parameter in **JoinLNN()**. In this case, the value of **networkId** is valid and will be used in the data transmission and disconnection APIs. If the value of **retCode** is not **0**, the connection fails, and the value of **networkId** is invalid.
1533. Transmit data using transmission APIs.
1544. Initiate a disconnection request with the **networkId** and the callback.
155
156 ```C
157 // Callback invoked to return the disconnection result.
158 typedef void (*OnLeaveLNNResult)(const char *networkId, int32_t retCode);
159
160 // Initiate a disconnection request.
161 int32_t LeaveLNN(const char *pkgName, const char *networkId, OnLeaveLNNResult cb);
162 ```
163
1645. Wait until the disconnection is complete. The **networkId** parameter in **OnLeaveLNNResult()** matches **networkId** in **LeaveLNN()**. If **retCode** is **0**, the disconnection is successful; otherwise, the disconnection fails. If the disconnection is successful, **networkId** becomes invalid and can no longer be used.
1656. Register and unregister callbacks for device state changes.
166
167 ```C
168 // Device state events.
169 #define EVENT_NODE_STATE_ONLINE 0x1
170 #define EVENT_NODE_STATE_OFFLINE 0x02
171 #define EVENT_NODE_STATE_INFO_CHANGED 0x04
172 #define EVENT_NODE_STATUS_CHANGED 0x08
173 #define EVENT_NODE_STATE_MASK 0xF
174
175 // Device information.
176 typedef struct {
177 char networkId[NETWORK_ID_BUF_LEN];
178 char deviceName[DEVICE_NAME_BUF_LEN];
179 uint16_t deviceTypeId;
180 } NodeBasicInfo;
181
182 // Device state event callbacks.
183 typedef struct {
184 uint32_t events; // Networking event mask.
185 void (*onNodeOnline)(NodeBasicInfo *info); // Called when the device gets online.
186 void (*onNodeOffline)(NodeBasicInfo *info); // Called when the device gets offline.
187 void (*onNodeBasicInfoChanged)(NodeBasicInfoType type, NodeBasicInfo *info); // Called when the device information changes.
188 void (*onNodeStatusChanged)(NodeStatusType type, NodeStatus *status); // Called when the device running status changes.
189 } INodeStateCb;
190
191 // Register the callback for device state events.
192 int32_t RegNodeDeviceStateCb(const char *pkgName, INodeStateCb *callback);
193
194 // Unregister the callback for device state events.
195 int32_t UnregNodeDeviceStateCb(INodeStateCb *callback);
196 ```
197
198**3. Transmission**
199
2001. Create a **Socket** instance.
201
202 ```C
203 typedef struct {
204 char *name; // Local socket name.
205 char *peerName; // Peer socket name.
206 char *peerNetworkId; // Peer network ID.
207 char *pkgName; // Bundle name of the caller.
208 TransDataType dataType; // Type of the data to be transmitted, which must be the same as that in the sender() method.
209 } SocketInfo;
210
211 // Create sockets.
212 int32_t Socket(SocketInfo info);
213 ```
214
2152. Start listening for the socket on the server, and bind the socket on the client.
216
217 ```C
218 // Callbacks for the socket.
219 typedef struct {
220 void (*OnBind)(int32_t socket, PeerSocketInfo info);
221 void (*OnShutdown)(int32_t socket, ShutdownReason reason);
222 void (*OnBytes)(int32_t socket, const void *data, uint32_t dataLen);
223 void (*OnMessage)(int32_t socket, const void *data, uint32_t dataLen);
224 void (*OnStream)(int32_t socket, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param);
225 void (*OnFile)(int32_t socket, FileEvent *event);
226 void (*OnQos)(int32_t socket, QoSEvent eventId, const QosTV *qos, uint32_t qosCount);
227 } ISocketListener;
228
229 typedef enum {
230 QOS_TYPE_MIN_BW, // Minimum bandwidth.
231 QOS_TYPE_MAX_LATENCY, // Maximum link setup latency.
232 QOS_TYPE_MIN_LATENCY, // Minimum link setup latency.
233 QOS_TYPE_MAX_WAIT_TIMEOUT, // Maximum timeout period.
234 QOS_TYPE_MAX_BUFFER, // Maximum buffer size.
235 QOS_TYPE_FIRST_PACKAGE, // Size of the first packet.
236 QOS_TYPE_MAX_IDLE_TIMEOUT, // Maximum idle time.
237 QOS_TYPE_TRANS_RELIABILITY,// Transmission reliability.
238 QOS_TYPE_BUTT,
239 } QosType;
240
241 typedef struct {
242 QosType qos;
243 int32_t value;
244 } QosTV;
245
246 // Start listening for the socket on the server.
247 int32_t Listen(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener);
248
249 // Bind the socket on the client.
250 int32_t Bind(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener);
251 ```
252
2534. Send data to the peer device through the socket.
254
255 ```C
256 // Send bytes.
257 int32_t SendBytes(int32_t socket, const void *data, uint32_t len);
258 // Send messages.
259 int32_t SendMessage(int32_t socket, const void *data, uint32_t len);
260 // Send streams.
261 int32_t SendStream(int32_t socket, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param);
262 // Send a file.
263 int32_t SendFile(int32_t socket, const char *sFileList[], const char *dFileList[], uint32_t fileCnt);
264 ```
265
2665. Shut down the socket.
267
268 ```C
269 // Shut down the socket.
270 void Shutdown(int32_t socket);
271 ```
272
273## Repositories Involved
274
275[DSoftBus](https://gitee.com/openharmony/docs/blob/master/en/readme/dsoftbus.md)
276
277**communication_dsoftbus**
278
279[communication_bluetooth](https://gitee.com/openharmony/communication_bluetooth)
280
281[communication_ipc](https://gitee.com/openharmony/communication_ipc)
282
283[communication_wifi](https://gitee.com/openharmony/communication_wifi)
284
README_zh.md
1# 分布式软总线组件<a name="ZH-CN_TOPIC_0000001103650648"></a>
2
3- [分布式软总线组件<a name="ZH-CN_TOPIC_0000001103650648"></a>](#分布式软总线组件)
4 - [简介<a name="section13587125816351"></a>](#简介)
5 - [系统架构<a name="section13587185873516"></a>](#系统架构)
6 - [目录<a name="section161941989596"></a>](#目录)
7 - [约束<a name="section119744591305"></a>](#约束)
8 - [说明<a name="section1312121216216"></a>](#说明)
9 - [使用说明<a name="section1698318421816"></a>](#使用说明)
10 - [相关仓<a name="section1371113476307"></a>](#相关仓)
11
12## 简介<a name="section13587125816351"></a>
13
14现实中多设备间通信方式多种多样\(WIFI、蓝牙等\),不同的通信方式使用差异大,导致通信问题多;同时还面临设备间通信链路的融合共享和冲突无法处理等挑战。分布式软总线实现近场设备间统一的分布式通信管理能力,提供不区分链路的设备间发现连接、组网和传输能力,主要功能如下:
15
16- 发现连接:提供基于Wifi、蓝牙等通信方式的设备发现连接能力。
17- 设备组网:提供统一的设备组网和拓扑管理能力,为数据传输提供已组网设备信息。
18- 数据传输:提供数据传输通道,支持消息、字节、流、文件的数据传输能力。
19
20业务方通过使用分布式软总线提供的API实现设备间的高速通信,不用关心通信细节,进而实现业务平台的高效部署与运行能力。
21
22## 系统架构<a name="section13587185873516"></a>
23
24
25**图 1** 分布式软总线组件架构图<a name="fig4460722185514"></a>
26
27## 目录<a name="section161941989596"></a>
28
29分布式软总线组件主要代码目录结构如下:
30
31```text
32//foundation/communication/dsoftbus
33├── adapter # 适配层代码
34├── components # 依赖组件代码
35├── core # 核心代码
36│ ├── adapter # 适配层代码
37│ ├── authentication # 认证代码
38│ ├── bus_center # 组网代码
39│ ├── common # 通用代码
40│ ├── connection # 连接代码
41│ ├── discovery # 发现代码
42│ ├── frame # 框架代码
43│ └── transmission # 传输代码
44├── interfaces # 对外接口代码
45├── sdk # 运行业务进程代码
46│ ├── bus_center # 组网代码
47│ ├── discovery # 发现代码
48│ ├── frame # 框架代码
49│ └── transmission # 传输代码
50├── tests # 测试代码
51└── tools # 工具代码
52```
53
54## 约束<a name="section119744591305"></a>
55
56- 组网设备需在同一局域网中 或者 距离相近的近场设备间。
57- 组网之前,需先完成设备绑定,绑定流程参见安全子系统中说明。
58- 传输完成数据收发之后,业务要主动关闭会话,释放资源。
59
60## 说明<a name="section1312121216216"></a>
61
62### 使用说明<a name="section1698318421816"></a>
63
64>**须知:**
65>使用跨设备通信时,必须添加权限`ohos.permission.DISTRIBUTED_DATASYNC`和`ohos.permission.DISTRIBUTED_SOFTBUS_CENTER`,该权限类型为 _**dangerous**_ 。
66
67>设备主动发现手机时,手机需打开超级终端的允许被“附近设备”发现开关(设置-超级终端-我的设备-允许被发现-附近设备),才能被设备发现。
68
69**1、发现**
70
71- **发布流程**
72
731. 上层应用需要对外发布自身能力时,调用服务发布接口发布自身能力。
74
75 ```C
76 // 发布回调
77 typedef struct {
78 /** Callback for publish result */
79 void (*OnPublishResult)(int publishId, PublishResult reason);
80 } IPublishCb;
81
82 // 发布服务
83 int32_t PublishLNN(const char *pkgName, const PublishInfo *info, const IPublishCb *cb);
84 ```
85
862. 上层应用不再需要对外发布自身能力时,调用StopPublishLNN接口注销服务。
87
88 ```C
89 // 注销服务
90 int32_t StopPublishLNN(const char *pkgName, int32_t publishId);
91 ```
92
93
94- **发现流程**
95
961. 上层应用需要发现特定能力设备时,调用发现接口启动发现。
97
98 ```C
99 // 发现回调
100 typedef struct {
101 /** Callback that is invoked when a device is found */
102 void (*OnDeviceFound)(const DeviceInfo *device);
103 /** Callback for a subscription result */
104 void (*OnDiscoverResult)(int32_t refreshId, RefreshResult reason);
105 } IRefreshCallback;
106
107 // 发现服务
108 int32_t RefreshLNN(const char *pkgName, const SubscribeInfo *info, const IRefreshCallback *cb);
109 ```
110
1112. 当软总线发现到设备时,通过回调接口通知业务所发现的设备信息。
1123. 上层应用不再需要发现时,调用StopRefreshLNN接口停止设备发现。
113
114 ```C
115 // 停止发现
116 int32_t StopRefreshLNN(const char *pkgName, int32_t refreshId);
117 ```
118
119**2、组网**
120
1211. 发起组网请求,携带组网连接地址信息,并且提供组网执行结果回调函数。
122
123 ```C
124 // 组网连接地址
125 typedef struct {
126 ConnectionAddrType type;
127 union {
128 struct BrAddr {
129 char brMac[BT_MAC_LEN];
130 } br;
131 struct BleAddr {
132 char bleMac[BT_MAC_LEN];
133 uint8_t udidHash[UDID_HASH_LEN];
134 } ble;
135 struct IpAddr {
136 char ip[IP_STR_MAX_LEN];
137 uint16_t port;
138 } ip;
139 } info;
140 char peerUid[MAX_ACCOUNT_HASH_LEN];
141 } ConnectionAddr;
142
143 // 组网连接地址类型
144 typedef enum {
145 CONNECTION_ADDR_WLAN = 0,
146 CONNECTION_ADDR_BR,
147 CONNECTION_ADDR_BLE,
148 CONNECTION_ADDR_ETH,
149 CONNECTION_ADDR_MAX
150 } ConnectionAddrType;
151
152 // 组网请求执行结果回调
153 typedef void (*OnJoinLNNResult)(ConnectionAddr *addr, const char *networkId, int32_t retCode);
154
155 // 发起组网请求
156 int32_t JoinLNN(const char *pkgName, ConnectionAddr *target, OnJoinLNNResult cb);
157 ```
158
1592. 等待组网结果,JoinLNN\(\)返回成功表示软总线接受了组网请求,组网结果通过回调函数通知业务;组网回调函数中addr参数内容和JoinLNN\(\)的入参互相匹配;retCode如果为0,表示组网成功,此时networkId为有效值,后续传输、退网等接口均需使用该参数;retCode如果不为0,表示组网失败,此时networkId为无效值。
1603. 使用传输相关接口进行数据传输。
1614. 发送退网请求,携带组网成功后返回的networkId,并且提供退网执行结果回调。
162
163 ```C
164 // 退网执行结果回调
165 typedef void (*OnLeaveLNNResult)(const char *networkId, int32_t retCode);
166
167 // 退网请求
168 int32_t LeaveLNN(const char *pkgName, const char *networkId, OnLeaveLNNResult cb);
169 ```
170
1715. 等待退网完成,OnLeaveLNNResult\(\)的networkId和退网请求接口中的networkId互相匹配;retCode为0表示退网成功,否则退网失败。退网成功后,networkId变为无效值,后续不应该被继续使用。
1726. 使用节点(即设备)注册和注销接口,监听网络中节点状态变化等事件。
173
174 ```C
175 // 事件掩码
176 #define EVENT_NODE_STATE_ONLINE 0x1
177 #define EVENT_NODE_STATE_OFFLINE 0x02
178 #define EVENT_NODE_STATE_INFO_CHANGED 0x04
179 #define EVENT_NODE_STATUS_CHANGED 0x08
180 #define EVENT_NODE_STATE_MASK 0xF
181
182 // 节点信息
183 typedef struct {
184 char networkId[NETWORK_ID_BUF_LEN];
185 char deviceName[DEVICE_NAME_BUF_LEN];
186 uint16_t deviceTypeId;
187 } NodeBasicInfo;
188
189 // 节点状态事件回调
190 typedef struct {
191 uint32_t events; // 组网事件掩码
192 void (*onNodeOnline)(NodeBasicInfo *info); // 节点上线事件回调
193 void (*onNodeOffline)(NodeBasicInfo *info); // 节点下线事件回调
194 void (*onNodeBasicInfoChanged)(NodeBasicInfoType type, NodeBasicInfo *info); // 节点信息变化事件回调
195 void (*onNodeStatusChanged)(NodeStatusType type, NodeStatus *status); // 设备运行状态变化事件回调
196 } INodeStateCb;
197
198 // 注册节点状态事件回调
199 int32_t RegNodeDeviceStateCb(const char *pkgName, INodeStateCb *callback);
200
201 // 注销节点状态事件回调
202 int32_t UnregNodeDeviceStateCb(INodeStateCb *callback);
203 ```
204
205**3、传输**
206
2071. 创建Socket。
208
209 ```C
210 typedef struct {
211 char *name; // 本端Socket名称
212 char *peerName; // 对端Socket名称
213 char *peerNetworkId; // 对端Socket的网络ID
214 char *pkgName; // 调用者包名
215 TransDataType dataType; // 传输的数据类型,需要与发送方法一致
216 } SocketInfo;
217
218 // 创建Socket
219 int32_t Socket(SocketInfo info);
220 ```
221
2222. 服务端启动监听,客户端进行绑定。
223
224 ```C
225 // Socket回调函数
226 typedef struct {
227 void (*OnBind)(int32_t socket, PeerSocketInfo info);
228 void (*OnShutdown)(int32_t socket, ShutdownReason reason);
229 void (*OnBytes)(int32_t socket, const void *data, uint32_t dataLen);
230 void (*OnMessage)(int32_t socket, const void *data, uint32_t dataLen);
231 void (*OnStream)(int32_t socket, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param);
232 void (*OnFile)(int32_t socket, FileEvent *event);
233 void (*OnQos)(int32_t socket, QoSEvent eventId, const QosTV *qos, uint32_t qosCount);
234 } ISocketListener;
235
236 typedef enum {
237 QOS_TYPE_MIN_BW, // 最小带宽
238 QOS_TYPE_MAX_LATENCY, // 最大建链时延
239 QOS_TYPE_MIN_LATENCY, // 最小建链时延
240 QOS_TYPE_MAX_WAIT_TIMEOUT, // 最大超时时间
241 QOS_TYPE_MAX_BUFFER, // 最大缓存
242 QOS_TYPE_FIRST_PACKAGE, // 首包大小
243 QOS_TYPE_MAX_IDLE_TIMEOUT, // 最大空闲时间
244 QOS_TYPE_TRANS_RELIABILITY, // 传输可靠性
245 QOS_TYPE_BUTT,
246 } QosType;
247
248 typedef struct {
249 QosType qos;
250 int32_t value;
251 } QosTV;
252
253 // 监听Socket,由服务端开启。
254 int32_t Listen(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener);
255
256 // 绑定Socket,由客户端开启。
257 int32_t Bind(int32_t socket, const QosTV qos[], uint32_t qosCount, const ISocketListener *listener);
258 ```
259
2604. 通过Socket向对端设备发送数据。
261
262 ```C
263 // 发送字节数据
264 int32_t SendBytes(int32_t socket, const void *data, uint32_t len);
265 // 发送消息数据
266 int32_t SendMessage(int32_t socket, const void *data, uint32_t len);
267 // 发送流数据
268 int32_t SendStream(int32_t socket, const StreamData *data, const StreamData *ext, const StreamFrameInfo *param);
269 // 发送文件
270 int32_t SendFile(int32_t socket, const char *sFileList[], const char *dFileList[], uint32_t fileCnt);
271 ```
272
2735. 关闭Socket。
274
275 ```C
276 // 关闭Socket
277 void Shutdown(int32_t socket);
278 ```
279
280## 相关仓<a name="section1371113476307"></a>
281
282[分布式软总线子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%88%86%E5%B8%83%E5%BC%8F%E8%BD%AF%E6%80%BB%E7%BA%BF%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
283
284**communication_dsoftbus**
285
286[communication_bluetooth](https://gitee.com/openharmony/communication_bluetooth)
287
288[communication_ipc](https://gitee.com/openharmony/communication_ipc)
289
290[communication_wifi](https://gitee.com/openharmony/communication_wifi)
291