Bläddra i källkod

服务端返回消息设置

master
OCEAN 2 månader sedan
förälder
incheckning
b5ff375567
80 ändrade filer med 1057 tillägg och 2 borttagningar
  1. +34
    -0
      .gitignore
  2. +886
    -0
      tcp_client/Cargo.lock
  3. +8
    -0
      tcp_client/Cargo.toml
  4. +52
    -0
      tcp_client/src/db.rs
  5. +64
    -0
      tcp_client/src/main.rs
  6. +13
    -2
      tcp_server/src/main.rs
  7. Binär
      tcp_server/target/debug/deps/tcp_server.exe
  8. Binär
      tcp_server/target/debug/deps/tcp_server.pdb
  9. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/027yitjfxrj0q08h5z24ilihc.o
  10. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/02ah9jgy0p9vusug82fss43mj.o
  11. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/093dmhu2kuhohgsvkf2xspdlu.o
  12. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0cjjdvmyv6nigzv431bulb8c8.o
  13. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0do0nr7l1feiwwj809yev69ph.o
  14. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0tk0mx2ba2y3jw6xmkze01ith.o
  15. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0xkak3de6wl49s5dtzdgi33hs.o
  16. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/122lgtt13cut95bb3b87jg18g.o
  17. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1b66hj7ctvdtxo4rwh7rbs1vw.o
  18. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1c4nkaecwxidlrysqhe0o1g14.o
  19. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1gnxcfwf6i05s0yle46x6vmeb.o
  20. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1sgdw98t75tflin52kkujcyf7.o
  21. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1w394l274hdz25dxudpeg1kwd.o
  22. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/20nfk4hwcfm85ikeifk7ph08z.o
  23. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/22e4mbhnti7k6965dnau110yb.o
  24. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/24gp1ld6huezn6nbj6skq6wuq.o
  25. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/2kl1r92kn2csw821ksb3iktab.o
  26. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/2las3skfgpmh7dhhawytx57ii.o
  27. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/38i5kl84w4z31pntdrtayy6jy.o
  28. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/3tkubfz2d3b9udhvs3itgsox4.o
  29. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/3ydrgtsqx8bh2duh0sd4qzyq3.o
  30. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/4n7ekwz97t0zb7dukkqa9icqq.o
  31. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/4nv1kzatsxoc5m4lhnlgxqh26.o
  32. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/4xo9ozzry9fqm2f52w1n0rgxc.o
  33. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/55hrjk3ouwkz98eq3fqs0qnm2.o
  34. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/5nig883jx8b5vci8sn1gl8vq7.o
  35. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/5o2kcb7f2fo2vnfqtu1p1mao3.o
  36. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/63ih6wum4gfypy9btm6qa6x8f.o
  37. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/68xlhkq1qxmr44kjp1sn2hh6p.o
  38. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/6z999pn5nblsun52szhq85dcw.o
  39. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/79uh38kls7rbffv6c9x96zhyb.o
  40. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/7p31rge4ka7fdtfdivd1wgwd4.o
  41. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/7qjxuf76uxeikrr14tdbzr6zl.o
  42. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/7xq7df72gdhf3d1ojjael6lcs.o
  43. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/8md2das62hyftjcrv39l1gkpw.o
  44. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/8qtmaopgbtvv8mpq56b49ncwv.o
  45. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/8ven38ljvmg09peoq4plpxl11.o
  46. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/999l1h06ve6n1tsk4tuzrgeln.o
  47. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/9brhv2kj8b801fplt18i5hbab.o
  48. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/9gcos3aytqb05unyl2vwm78jt.o
  49. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/9rvh7gf1q4xjui1f9ygwby1oj.o
  50. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/a6edgkgcjhvzc1yhx1n5ooaqh.o
  51. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/acwac796ce9feceqsif7osz5a.o
  52. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/amw3ekebrfp0wq9j9g84yyzqr.o
  53. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/ax26q9mob8oyzwu4j9s8eryl6.o
  54. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/az2fv672bwcwnohpneq695lsa.o
  55. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/b8ov8hq90l47nnsculkamot6a.o
  56. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/ba1y6tnah3pcfu6kkr2ztd6k9.o
  57. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bfjjwx0ylwtqu0mw0k2zl5vda.o
  58. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bnfv1ch3r7w41pbe6bt0l7wom.o
  59. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bo86lylo9qb9vuk161hri7s0e.o
  60. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bum5d2n7kcvyzdlddsftmq0a9.o
  61. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/c1ipchxq1hhj3sbz9xs5fds0r.o
  62. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/cmqtcj8wgtzwvvnabifz0fw1g.o
  63. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/cvwgn9hjoulh5snbt79fh48ge.o
  64. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/cwwidhxa5byz3pb27kfvobaf1.o
  65. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/d3x9bay4ffo24yn83a8cqpo3i.o
  66. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/d4cqyiczbxb61ly2qxn8cs80e.o
  67. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/dep-graph.bin
  68. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/dk8cv5y484wl50uox9jaf2g52.o
  69. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/dnq4thfqmfsn7rgc17e2512vp.o
  70. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/e9844ipy7sg7ro5pwio0adc43.o
  71. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/eldq9jeokqcqfltj4iu9k3hnw.o
  72. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/elhan08rkkmemo3yl097sdtjn.o
  73. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/esv561yayjbccqvaob7m88y5p.o
  74. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/f3s6ii6nmvko62xhrtjsbzk8r.o
  75. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/f5hjpxzbetohrrbg8vgyu5kmw.o
  76. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/query-cache.bin
  77. Binär
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/work-products.bin
  78. +0
    -0
      tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq.lock
  79. Binär
      tcp_server/target/debug/tcp_server.exe
  80. Binär
      tcp_server/target/debug/tcp_server.pdb

+ 34
- 0
.gitignore Visa fil

@@ -0,0 +1,34 @@

#Ignore thumbnails created by Windows
Thumbs.db
#Ignore files built by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.lib
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
.vs/
#Nuget packages folder
packages/
tcp_client/target/
tcp_server/target/

+ 886
- 0
tcp_client/Cargo.lock Visa fil

@@ -0,0 +1,886 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4

[[package]]
name = "addr2line"
version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
dependencies = [
"gimli",
]

[[package]]
name = "adler2"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"

[[package]]
name = "async-trait"
version = "0.1.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "autocfg"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"

[[package]]
name = "backtrace"
version = "0.3.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a"
dependencies = [
"addr2line",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
"windows-targets",
]

[[package]]
name = "base64"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"

[[package]]
name = "bitflags"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"

[[package]]
name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]

[[package]]
name = "bumpalo"
version = "3.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"

[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"

[[package]]
name = "bytes"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"

[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"

[[package]]
name = "cpufeatures"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
dependencies = [
"libc",
]

[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]

[[package]]
name = "digest"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
"subtle",
]

[[package]]
name = "fallible-iterator"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"

[[package]]
name = "futures-channel"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
]

[[package]]
name = "futures-core"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"

[[package]]
name = "futures-macro"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "futures-sink"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"

[[package]]
name = "futures-task"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"

[[package]]
name = "futures-util"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-core",
"futures-macro",
"futures-sink",
"futures-task",
"pin-project-lite",
"pin-utils",
"slab",
]

[[package]]
name = "generic-array"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
]

[[package]]
name = "getrandom"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"wasi 0.14.2+wasi-0.2.4",
]

[[package]]
name = "gimli"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"

[[package]]
name = "hmac"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
dependencies = [
"digest",
]

[[package]]
name = "js-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]

[[package]]
name = "libc"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"

[[package]]
name = "lock_api"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [
"autocfg",
"scopeguard",
]

[[package]]
name = "log"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"

[[package]]
name = "md-5"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"
dependencies = [
"cfg-if",
"digest",
]

[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"

[[package]]
name = "miniz_oxide"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a"
dependencies = [
"adler2",
]

[[package]]
name = "mio"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
"libc",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys",
]

[[package]]
name = "object"
version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
dependencies = [
"memchr",
]

[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"

[[package]]
name = "parking_lot"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
]

[[package]]
name = "parking_lot_core"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets",
]

[[package]]
name = "percent-encoding"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"

[[package]]
name = "phf"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
dependencies = [
"phf_shared",
]

[[package]]
name = "phf_shared"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
dependencies = [
"siphasher",
]

[[package]]
name = "pin-project-lite"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"

[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"

[[package]]
name = "postgres-protocol"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76ff0abab4a9b844b93ef7b81f1efc0a366062aaef2cd702c76256b5dc075c54"
dependencies = [
"base64",
"byteorder",
"bytes",
"fallible-iterator",
"hmac",
"md-5",
"memchr",
"rand",
"sha2",
"stringprep",
]

[[package]]
name = "postgres-types"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613283563cd90e1dfc3518d548caee47e0e725455ed619881f5cf21f36de4b48"
dependencies = [
"bytes",
"fallible-iterator",
"postgres-protocol",
]

[[package]]
name = "ppv-lite86"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
dependencies = [
"zerocopy",
]

[[package]]
name = "proc-macro2"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]

[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]

[[package]]
name = "r-efi"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"

[[package]]
name = "rand"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
dependencies = [
"rand_chacha",
"rand_core",
]

[[package]]
name = "rand_chacha"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
dependencies = [
"ppv-lite86",
"rand_core",
]

[[package]]
name = "rand_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
dependencies = [
"getrandom",
]

[[package]]
name = "redox_syscall"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2f103c6d277498fbceb16e84d317e2a400f160f46904d5f5410848c829511a3"
dependencies = [
"bitflags",
]

[[package]]
name = "rustc-demangle"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"

[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"

[[package]]
name = "sha2"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]

[[package]]
name = "signal-hook-registry"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
dependencies = [
"libc",
]

[[package]]
name = "siphasher"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"

[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]

[[package]]
name = "smallvec"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"

[[package]]
name = "socket2"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef"
dependencies = [
"libc",
"windows-sys",
]

[[package]]
name = "stringprep"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
dependencies = [
"unicode-bidi",
"unicode-normalization",
"unicode-properties",
]

[[package]]
name = "subtle"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"

[[package]]
name = "syn"
version = "2.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]

[[package]]
name = "tcp_client"
version = "0.1.0"
dependencies = [
"tokio",
"tokio-postgres",
]

[[package]]
name = "tinyvec"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
dependencies = [
"tinyvec_macros",
]

[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"

[[package]]
name = "tokio"
version = "1.44.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"windows-sys",
]

[[package]]
name = "tokio-macros"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

[[package]]
name = "tokio-postgres"
version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c95d533c83082bb6490e0189acaa0bbeef9084e60471b696ca6988cd0541fb0"
dependencies = [
"async-trait",
"byteorder",
"bytes",
"fallible-iterator",
"futures-channel",
"futures-util",
"log",
"parking_lot",
"percent-encoding",
"phf",
"pin-project-lite",
"postgres-protocol",
"postgres-types",
"rand",
"socket2",
"tokio",
"tokio-util",
"whoami",
]

[[package]]
name = "tokio-util"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
]

[[package]]
name = "typenum"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"

[[package]]
name = "unicode-bidi"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"

[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"

[[package]]
name = "unicode-normalization"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
dependencies = [
"tinyvec",
]

[[package]]
name = "unicode-properties"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0"

[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"

[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"

[[package]]
name = "wasi"
version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
"wit-bindgen-rt",
]

[[package]]
name = "wasite"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"

[[package]]
name = "wasm-bindgen"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]

[[package]]
name = "web-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
"js-sys",
"wasm-bindgen",
]

[[package]]
name = "whoami"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7"
dependencies = [
"redox_syscall",
"wasite",
"web-sys",
]

[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
]

[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"

[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"

[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"

[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"

[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"

[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"

[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags",
]

[[package]]
name = "zerocopy"
version = "0.8.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879"
dependencies = [
"zerocopy-derive",
]

[[package]]
name = "zerocopy-derive"
version = "0.8.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be"
dependencies = [
"proc-macro2",
"quote",
"syn",
]

+ 8
- 0
tcp_client/Cargo.toml Visa fil

@@ -0,0 +1,8 @@
[package]
name = "tcp_client"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1.28", features = ["full"] }
tokio-postgres = "0.7"

+ 52
- 0
tcp_client/src/db.rs Visa fil

@@ -0,0 +1,52 @@
use tokio_postgres::{NoTls, Error};

pub struct DbConfig {
host: String,
port: u16,
dbname: String,
user: String,
password: String,
}

impl DbConfig {
pub fn new() -> Self {
Self {
host: String::from("10.180.4.100"),
port: 5432,
dbname: String::from("Auseft_RL_Web"),
user: String::from("postgres"),
password: String::from("Auseft@2025qwer"),
}
}

pub fn connection_string(&self) -> String {
format!(
"host={} port={} dbname={} user={} password={}",
self.host, self.port, self.dbname, self.user, self.password
)
}
}

pub async fn connect_db() -> Result<tokio_postgres::Client, Error> {
let config = DbConfig::new();
let connection_string = config.connection_string();
let (client, connection) = tokio_postgres::connect(&connection_string, NoTls).await?;
// The connection object performs the actual communication with the database,
// so spawn it off to run on its own
tokio::spawn(async move {
if let Err(e) = connection.await {
eprintln!("Connection error: {}", e);
}
});

Ok(client)
}

// Example function to test the connection
pub async fn test_connection() -> Result<bool, Error> {
let client = connect_db().await?;
let rows = client.query("SELECT 1", &[]).await?;
Ok(!rows.is_empty())
}

+ 64
- 0
tcp_client/src/main.rs Visa fil

@@ -0,0 +1,64 @@
mod db;

use std::net::TcpStream;
use std::io::{Read, Write};
use std::thread;
use std::time::Duration;

#[tokio::main]
async fn main() {
let max_retries = 3;
let mut retry_count = 0;

while retry_count < max_retries {
println!("尝试连接服务器 (第{}次)...", retry_count + 1);
match TcpStream::connect("10.180.4.88:9090") {
Ok(mut stream) => {
println!("成功连接到服务器!");
// 设置读写超时
stream.set_read_timeout(Some(Duration::from_secs(5))).unwrap();
stream.set_write_timeout(Some(Duration::from_secs(5))).unwrap();

// 发送数据
let msg = "HelloOK";
match stream.write(msg.as_bytes()) {
Ok(_) => println!("成功发送消息: {}", msg),
Err(e) => println!("发送消息失败: {}", e),
}

// 接收数据
let mut buffer = [0; 1];
match stream.read(&mut buffer) {
Ok(n) => {
if n == 1 {
let bit = buffer[0];
if bit == 0 || bit == 1 {
println!("接收到比特值: {}", bit);
} else {
println!("接收到非预期的值: {} (十六进制: {:02X})", bit, bit);
}
} else {
println!("未接收到数据");
}
}
Err(e) => println!("接收数据失败: {}", e),
}
break; // 如果成功连接并通信,跳出重试循环
}
Err(e) => {
println!("连接服务器失败: {}", e);
retry_count += 1;
if retry_count < max_retries {
println!("等待3秒后重试...");
thread::sleep(Duration::from_secs(3));
}
}
}
}

if retry_count >= max_retries {
println!("达到最大重试次数,程序退出");
}
}

+ 13
- 2
tcp_server/src/main.rs Visa fil

@@ -1,6 +1,15 @@
use tokio::net::TcpListener;
use tokio::io::{AsyncReadExt, AsyncWriteExt};

fn check_ok_message(message: &[u8]) -> u8 {
let message_str = String::from_utf8_lossy(message);
if message_str.contains("OK") {
1
} else {
0
}
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let listener = TcpListener::bind("127.0.0.1:9090").await?;
@@ -20,8 +29,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
return;
}
Ok(n) => {
// Echo the data back to the client
if let Err(e) = socket.write_all(&buf[..n]).await {
// Check message and send single bit response
let response = check_ok_message(&buf[..n]);
println!("接收到消息: {},响应: {}", String::from_utf8_lossy(&buf[..n]), response);
if let Err(e) = socket.write_all(&[response]).await {
println!("Failed to write to socket: {}", e);
return;
}


Binär
tcp_server/target/debug/deps/tcp_server.exe Visa fil


Binär
tcp_server/target/debug/deps/tcp_server.pdb Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/027yitjfxrj0q08h5z24ilihc.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/02ah9jgy0p9vusug82fss43mj.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/093dmhu2kuhohgsvkf2xspdlu.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0cjjdvmyv6nigzv431bulb8c8.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0do0nr7l1feiwwj809yev69ph.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0tk0mx2ba2y3jw6xmkze01ith.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/0xkak3de6wl49s5dtzdgi33hs.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/122lgtt13cut95bb3b87jg18g.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1b66hj7ctvdtxo4rwh7rbs1vw.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1c4nkaecwxidlrysqhe0o1g14.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1gnxcfwf6i05s0yle46x6vmeb.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1sgdw98t75tflin52kkujcyf7.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/1w394l274hdz25dxudpeg1kwd.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/20nfk4hwcfm85ikeifk7ph08z.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/22e4mbhnti7k6965dnau110yb.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/24gp1ld6huezn6nbj6skq6wuq.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/2kl1r92kn2csw821ksb3iktab.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/2las3skfgpmh7dhhawytx57ii.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/38i5kl84w4z31pntdrtayy6jy.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/3tkubfz2d3b9udhvs3itgsox4.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/3ydrgtsqx8bh2duh0sd4qzyq3.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/4n7ekwz97t0zb7dukkqa9icqq.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/4nv1kzatsxoc5m4lhnlgxqh26.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/4xo9ozzry9fqm2f52w1n0rgxc.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/55hrjk3ouwkz98eq3fqs0qnm2.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/5nig883jx8b5vci8sn1gl8vq7.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/5o2kcb7f2fo2vnfqtu1p1mao3.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/63ih6wum4gfypy9btm6qa6x8f.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/68xlhkq1qxmr44kjp1sn2hh6p.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/6z999pn5nblsun52szhq85dcw.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/79uh38kls7rbffv6c9x96zhyb.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/7p31rge4ka7fdtfdivd1wgwd4.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/7qjxuf76uxeikrr14tdbzr6zl.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/7xq7df72gdhf3d1ojjael6lcs.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/8md2das62hyftjcrv39l1gkpw.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/8qtmaopgbtvv8mpq56b49ncwv.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/8ven38ljvmg09peoq4plpxl11.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/999l1h06ve6n1tsk4tuzrgeln.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/9brhv2kj8b801fplt18i5hbab.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/9gcos3aytqb05unyl2vwm78jt.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/9rvh7gf1q4xjui1f9ygwby1oj.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/a6edgkgcjhvzc1yhx1n5ooaqh.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/acwac796ce9feceqsif7osz5a.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/amw3ekebrfp0wq9j9g84yyzqr.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/ax26q9mob8oyzwu4j9s8eryl6.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/az2fv672bwcwnohpneq695lsa.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/b8ov8hq90l47nnsculkamot6a.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/ba1y6tnah3pcfu6kkr2ztd6k9.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bfjjwx0ylwtqu0mw0k2zl5vda.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bnfv1ch3r7w41pbe6bt0l7wom.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bo86lylo9qb9vuk161hri7s0e.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/bum5d2n7kcvyzdlddsftmq0a9.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/c1ipchxq1hhj3sbz9xs5fds0r.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/cmqtcj8wgtzwvvnabifz0fw1g.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/cvwgn9hjoulh5snbt79fh48ge.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/cwwidhxa5byz3pb27kfvobaf1.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/d3x9bay4ffo24yn83a8cqpo3i.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/d4cqyiczbxb61ly2qxn8cs80e.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/dep-graph.bin Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/dk8cv5y484wl50uox9jaf2g52.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/dnq4thfqmfsn7rgc17e2512vp.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/e9844ipy7sg7ro5pwio0adc43.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/eldq9jeokqcqfltj4iu9k3hnw.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/elhan08rkkmemo3yl097sdtjn.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/esv561yayjbccqvaob7m88y5p.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/f3s6ii6nmvko62xhrtjsbzk8r.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/f5hjpxzbetohrrbg8vgyu5kmw.o Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/query-cache.bin Visa fil


Binär
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq-3qg27qxa1gte1fyz6tqoqrthv/work-products.bin Visa fil


+ 0
- 0
tcp_server/target/debug/incremental/tcp_server-18rmglvharcg7/s-h6l9758tlp-1yr80wq.lock Visa fil


Binär
tcp_server/target/debug/tcp_server.exe Visa fil


Binär
tcp_server/target/debug/tcp_server.pdb Visa fil


Laddar…
Avbryt
Spara