-#
+# 01
+
+```shell
+$ gcc --version
+gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
+Copyright (C) 2023 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+```
+
+
+# 02
+
+```shell
+$ cargo --version
+cargo 1.86.0 (adf9b6ad1 2025-02-28)
+```
+
+# 03
+
+```shell
+$ uname -a
+Linux ubuntu24-8 6.8.0-58-generic #60-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 14 18:29:48 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
+```
+
+# 04
+
+```shell
+$ nc -l 0.0.0.0 9999
+
+```
+
+# 05
+
+```shell
+
+$ nc 0.0.0.0 9999
+
+```
+
+
+# 06
+
+```shell
+$ nc 0.0.0.0 9999
+asdfqwer
+
+$ nc -l 0.0.0.0 9999
+asdfqwer
+```
+
+# 07
+
+```shell
+
+$ nc -l 0.0.0.0 9999 < test.http
+
+
+$ nc 0.0.0.0 9999
+HTTP/1.0 200 OK
+
+<html>
+ <body>
+ <h1>Hello, world!</h1>
+ </body>
+</html>
+```
+
+# 08
+
+```shell
+ncat$ make
+```
+
+# 09
```shell
GCC_FLAGS := -Wall -O2 -static
```
+# 10
+
+```shell
+0xetc/0xrs/ncat$ ./build.sh
+```
+
+# 11
```shell
cargo build --release
# https://doc.rust-lang.org/book/ch14-01-release-profiles.html
```
-#
-```shell
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/ncat$ wc test.txt
- 1000001 1000001 65000005 test.txt
+# 12
-```
-```shell
+```c
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/0xetc/0xrs/ncat$ wc test.txt
- 1000001 1000001 65000005 test.txt
-```
+// data
+// struct to hold global variables
-#
+typedef struct NCAT_OPTIONS {
-```shell
+ int mode_client;
+ int mode_listen;
+ int _client_sock_ready;
+ int _client_sockfd;
+ int _server_sig[2];
+ char* host;
+ char* port;
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/ncat$ du -h ncat.out
-1.1M ncat.out
-```
+} NCAT_OPTIONS;
+
+...
+
+// the global variable struct
+
+extern NCAT_OPTIONS ncat_opts;
+
+...
+
+// flow
+// 01. register keyboard interrupt
+
+void NCAT_keyboard_interrupt();
+
+// 02. parse arguments and make it usable across the program
+
+int NCAT_parse_args(int argc, char** argv);
+
+// 03. free allocated memories
+
+void NCAT_free();
+
+// 04. create thread, decide whether to run client or server
+
+int NCAT_runner();
+
+// 05. client mode, read from stdin and send to server
+
+int NCAT_client();
+
+// 05. server mode, accept, read, and write to stdout
+
+int NCAT_listen_and_serve();
+
+// 06. in client mode, it reads server message and write to stdout,
+// in server mode, it reads from stdin and ready the buffer to serve
+// on new connection
+
+void* NCAT_get_thread();
+
+
+
+...
-```shell
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/0xetc/0xrs/ncat$ du -h ncat.out
-640K ncat.out
```
-#
+
+
+# 13
```shell
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/ncat$ ./test.sh
+ncat$ ./test.sh
creating interface...
creating 1000000 entries...
test.txt exists
```
-#
+# 14
```shell
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/0xetc/0xrs/ncat$ ./test.sh
+0xetc/0xrs/ncat$ ./test.sh
creating interface...
creating 1000000 entries...
test.txt exists
```
-#
+# 15
```c
/*
```
-#
+# 16
```rust
-#
+# 17
```c
```shell
-thy@thy-Z370-HD3:~/hack/linux/linuxyz/ncat$ ./test.sh
+ncat$ ./test.sh
creating interface...
creating 1000000 entries...
test.txt exists