mirror of
https://github.com/Linloir/Simple-TCP-Server.git
synced 2025-12-16 23:48:11 +08:00
Change database directory & add readme
This commit is contained in:
parent
bb13789271
commit
eae2ceb3eb
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
.packages
|
||||
|
||||
.tmp/
|
||||
.data/
|
||||
.data/**
|
||||
|
||||
# Conventional directory for build output.
|
||||
|
||||
24
README.md
24
README.md
@ -1,2 +1,22 @@
|
||||
A sample command-line application with an entrypoint in `bin/`, library code
|
||||
in `lib/`, and example unit test in `test/`.
|
||||
# Simple TCP Server
|
||||
|
||||
This is ~~a project of my Computer Internet course~~ a project inspired by my school homework.
|
||||
|
||||
Several days before I'm asked to write a project on TCP server-client communication, and I wondered why not build a simple chat service beyond that which would be much more fun?
|
||||
|
||||
Therefore here it is, a simple tcp server with several functions which makes it acts like a small chat app.
|
||||
|
||||
## Functions
|
||||
|
||||
- User register / login / logout
|
||||
- Remember login state for device (simple token approach though)
|
||||
- Send messages via users
|
||||
- Search users and add contacts (and accept them of course)
|
||||
- Message sync via different devices
|
||||
- Send message to offline server (a SMTP-like approach)
|
||||
- File handling (transfer to and fetch from server)
|
||||
|
||||
## Notice
|
||||
|
||||
- To support multilanguage, use `base64Encode(utf8.encode(yourMessageHere))` before wrapping client messages in json object and sending that to the server (the serve will crash!)
|
||||
- Always open a new TCP connection to fetch or send file
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author : Linloir
|
||||
* @Date : 2022-10-06 16:15:01
|
||||
* @LastEditTime : 2022-10-09 20:28:49
|
||||
* @LastEditTime : 2022-10-09 20:31:23
|
||||
* @Description :
|
||||
*/
|
||||
|
||||
@ -25,12 +25,12 @@ class DataBaseHelper {
|
||||
|
||||
Future<void> initialize() async {
|
||||
_database = await databaseFactoryFfi.openDatabase(
|
||||
'E:\\database.db',
|
||||
'${Directory.current.path}/.tmp/database.db',
|
||||
options: OpenDatabaseOptions(
|
||||
version: 1,
|
||||
onCreate: (db, version) {
|
||||
onCreate: (db, version) async {
|
||||
print('[L] Creating Database.');
|
||||
db.execute(
|
||||
await db.execute(
|
||||
'''
|
||||
CREATE TABLE users (
|
||||
userid integer primary key autoincrement,
|
||||
@ -77,6 +77,7 @@ class DataBaseHelper {
|
||||
);
|
||||
'''
|
||||
);
|
||||
print('[L] Database created');
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user