Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 40dd726

Browse filesBrowse files
committed
[U] todo内容;bio代码;
1 parent afba7af commit 40dd726
Copy full SHA for 40dd726

File tree

Expand file treeCollapse file tree

2 files changed

+44
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+44
-1
lines changed
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ SpringCloud源码
145145

146146
todo
147147

148+
2021年年底完成了人生的两件大事,所以一直没时间持续输出源码分析,2022年开始需要继续努力,完成这个源码分析项目!
149+
150+
- 完成Netty剩余源码分析文章
151+
- 完成RocketMQ剩余源码分析文章
152+
- 完成Dubbo剩余源码分析文章
153+
- C语言基础学习(为Redis底层源码学习做准备)
148154
- Redis底层源码分析
149155
- JUC底层源码分析
150156

Collapse file

‎note/Netty/Netty底层源码解析-初始Netty及其架构.md‎

Copy file name to clipboardExpand all lines: note/Netty/Netty底层源码解析-初始Netty及其架构.md
+38-1Lines changed: 38 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
## 1. 回顾BIO和NIO
22

3-
show you the code! TODO
3+
```java
4+
public class BIO {
5+
public static void main(String[] args) throws Exception {
6+
ServerSocket serverSocket = new ServerSocket(666);
7+
System.out.println("Server started...");
8+
while (true) {
9+
System.out.println("socket accepting...");
10+
Socket socket = serverSocket.accept();
11+
new Thread(new Runnable() {
12+
@Override
13+
public void run() {
14+
try {
15+
byte[] bytes = new byte[1024];
16+
InputStream inputStream = socket.getInputStream();
17+
while (true) {
18+
System.out.println("reading...");
19+
int read = inputStream.read(bytes);
20+
if (read != -1) {
21+
System.out.println(new String(bytes, 0, read));
22+
} else {
23+
break;
24+
}
25+
}
26+
} catch (Exception e) {
27+
e.printStackTrace();
28+
} finally {
29+
try {
30+
socket.close();
31+
} catch (Exception e) {
32+
e.printStackTrace();
33+
}
34+
}
35+
}
36+
}).start();
37+
}
38+
}
39+
}
40+
```
441

542
BIO流程图如下:
643

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.