• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# DSoftBus
2
3## Introduction
4
5The DSoftBus subsystem provides the following communication capabilities for OpenHarmony:
6
7- WLAN: basic WLAN functions, peer-to-peer (P2P) connection, and WLAN notification, enabling your application to communicate with other devices through a WLAN.
8
9- Bluetooth: classic Bluetooth and Bluetooth Low Energy (BLE).
10
11- DSoftBus: distributed communications between near-field devices, and device discovery, connection setup, networking, and data transmission capabilities regardless of communication modes.
12
13- Remote procedure call (RPC): communications between processes on a device or across devices.
14
15
16## Architecture
17
18**Figure 1** DSoftBus architecture
19
20
21![](figures/dsoftbus.png)
22
23## Directory Structure
24
25The DSoftBus directory structure is as follows:
26
27```
28/foundation/communication
29├── bluetooth       # Bluetooth code
30├── dsoftbus        # DSoftBus code
31├── ipc             # IPC code
32└── wifi            # WLAN code
33```
34
35## Constraints
36
37The devices must be in the same LAN.
38
39## Usage
40
41### RPC
42
43In an RPC, the client process obtains the proxy of the process that provides the service (server). Through the proxy, the two processes communicate with each other.
44
451.  Implement the server capabilities.
462.  The client obtains a proxy of the server. This proxy provides the same capabilities as the server. To call a method of the server, the client only needs to call the same method of the proxy.
473.  The server processes the received request and returns the result to the proxy via the driver.
484.  The proxy returns the result to the client.
49
50### DSoftBus
51
52-   Networking
53
541.  The server starts and obtains the list of online devices.
552.  Register a listener for device status changes.
563.  Obtain the device ID, name, and type.
574.  Obtain detailed information about the device, such as the device type, networking type, and device capability.
585.  Delete the registered listener when the process exits.
59
60-   Transmission
61
621.  Creates a socket instance based on information, such as the socket name and caller bundle name.
632.  The server starts listening for the socket, and the client binds the socket.
643.  Send data after the bind is successful.
654.  Close the socket when it is not used.
66
67## Repositories Involved
68
69**DSoftBus subsystem**
70
71[communication\_bluetooth](https://gitee.com/openharmony/communication_bluetooth)
72
73[communication\_dsoftbus](https://gitee.com/openharmony/communication_dsoftbus)
74
75[communication\_ipc](https://gitee.com/openharmony/communication_ipc)
76
77[communication\_wifi](https://gitee.com/openharmony/communication_wifi)
78