Browse Source

...

master
michael 4 months ago
parent
commit
62c9333765
Signed by: Michael Zhang <iptq@protonmail.com> GPG Key ID: 5BAEFE5D04F0CE6C
5 changed files with 27 additions and 2 deletions
  1. 6
    0
      .editorconfig
  2. 1
    0
      content/pages/_index.md
  3. 0
    1
      content/pages/about.md
  4. 20
    0
      content/pages/analogies.md
  5. 0
    1
      content/pages/setup.md

+ 6
- 0
.editorconfig View File

@@ -0,0 +1,6 @@
1
+root = true
2
+
3
+[*]
4
+end_of_file = lf
5
+insert_final_newline = true
6
+trim_trailing_whitespace = true

+ 1
- 0
content/pages/_index.md View File

@@ -1,4 +1,5 @@
1 1
 +++
2 2
 title = "all pages"
3 3
 template = "listing.html"
4
+page_template = "post.html"
4 5
 +++

+ 0
- 1
content/pages/about.md View File

@@ -1,6 +1,5 @@
1 1
 +++
2 2
 title = "about me"
3
-template = "post.html"
4 3
 +++
5 4
 
6 5
 Hi there! I'm a Computer Science student at the University of Minnesota, and I've got a wide variety of interests under this field. I've been doing web development for a long time and now I'm looking into security, programming language development, and software development!

+ 20
- 0
content/pages/analogies.md View File

@@ -0,0 +1,20 @@
1
++++
2
+title = "interesting cs analogies"
3
++++
4
+
5
+stupid analogies i think of in my free time
6
+
7
+## socket server + multiple clients analogy
8
+
9
+If you think about it, a server waiting for clients is kind of like the host at the front of a restaurant leading guests to tables. They don't actually take orders or serve food, they just stand at the front and wait for new guests to arrive. Then there's another waiter that's specifically assigned to take that table's orders.
10
+
11
+When a server binds to, for example, `localhost:3000`, what the server really gets is a file descriptor; this is what's meant by:
12
+
13
+```c
14
+int socket(int domain, int type, int protocol);
15
+int bind(int socket, const struct sockaddr *address, socklen_t address_len);
16
+```
17
+
18
+The `listen` library call then marks this socket as one that's open for connections, similar to marking the restaurant staff as a host rather than a waiter.
19
+
20
+According to the manpage for `accept`, when a connection-mode socket accepts a connection, it'll "extract the first connection on the queue of pending connections, create a new socket with the same socket type protocol and address family as the specified socket, and allocate a new file descriptor for that socket." This new socket would be the waiter who actually takes your orders.

+ 0
- 1
content/pages/setup.md View File

@@ -1,6 +1,5 @@
1 1
 +++
2 2
 title = "my setup"
3
-template = "post.html"
4 3
 +++
5 4
 
6 5
 ## desktop

Loading…
Cancel
Save