1
0
mirror of https://github.com/fumiama/simple-dict.git synced 2026-06-05 18:20:26 +08:00
This commit is contained in:
fumiama
2021-03-21 15:54:05 +08:00
parent 51b8f1799c
commit 445f4e3fdb

View File

@@ -7,12 +7,12 @@ If you plan to compile it on Windows, you should edit the source code and transf
```bash
git clone https://github.com/fumiama/simple-dict-server.git
```
Now create a `build` folder.
Create a `build` folder.
```bash
cd simple-dict-server
mkdir build
```
Then use `cmake` command to generate files for `make` automatically.
Use `cmake` command to generate files for `make` automatically.
```bash
cd build
cmake ../
@@ -23,17 +23,17 @@ make
```
# Execute
Now we will show you how to start the server on localhost. You can try the command below.
Start server on localhost using the commands below.
```bash
chmod +x simple-dict-server simple-dict-client
./simple-dict-server -d 7777 1 ./dict.bin # use -d to start as daemon
```
Then you can open another shell to connect to it.
Open another shell to connect to it.
```bash
./simple-dict-client 127.0.0.1 7777
```
Now you have connected to the server. Type `fumiama` and press enter in `10` seconds to get the read/write access. You can modify the password in the source code as you like. Please note that the server will only wait `10` seconds for a response after the last communication. The communication below shows how to control the server to accompilsh basic add/del/find/edit operations.
```bash
Now you have connected to the server. Type `fumiama` and press enter in `10` seconds to get the read/write access. You can modify the password in source code as you like. Please note that the server will only wait `10` seconds for a response after the last communication. The box below shows how to control the server to accompilsh basic add/del/find/edit operations.
```c
break!
Get sockfd
Connected to server
@@ -64,7 +64,7 @@ Enter command:test
Recv 4 bytes: data
Enter command:测试
Recv 4 bytes: succ
Enter command:lst #list all keys match pattern
Enter command:lst #list all keys that match the pattern
Recv 3 bytes: lst
Enter command:t #pattern
Recv 5 bytes: test
@@ -73,7 +73,7 @@ Enter command:quit
Enter command:^C
```
You can also use `cat` command to get the raw data directly.
```bash
```c
break!
Get sockfd
Connected to server
@@ -85,11 +85,11 @@ Recv 131 bytes: 128test测试
Enter command:quit
Enter command:^C
```
The raw data starts with a integer showing the size of data, then send all data in `./dict.bin` to the client.
The raw data starts with an integer showing its size, following all binary data in `./dict.bin`.
# Android Client for simple-dict-server
There is also a [Android Client](https://github.com/fumiama/simple-dict-android) for simple-dict-server. Just install it from release page and click the `config` icon to set your server address using the format like
There is also an [Android Client](https://github.com/fumiama/simple-dict-android) for simple-dict-server. Just install the apk file downloaded from release page and click `config` icon to set your server address using the format
```
127.0.0.1:7777_password
```
Note that this APP is designed for a new language called `Tenenja`, so the font of this APP is abnormal. What's more, there is no English translation for this APP because its users are Chinese. If you want to get an APP in your language, just edit the source code for free.
Note that this APP is designed for a new language called `Tenenja`, so the font inside is abnormal. What's more, there is no English translation for this APP because its users are Chinese. If you want to get an APP in your language, just edit the source code for free.