http://chenshuo.com/practical-network-programming/
视频:https://www.bilibili.com/video/BV1sE41137zG?from=search&seid=191319194812128778
Course Description
Teach common network programming techniques by examplesFocus on server-side TCP network programming on LinuxWalk-through code in C++, Python and Go
Prerequisites
Have read Unix Network Programming volume 1 (either 2nd ed. or 3rd ed.) by late W. Richard StevensKnow basics of TCP/IP, eg. IP addresses, ports,Know how to write an echo server with basic sockets APIs in any language
Code
http://github.com/chenshuo/muduohttp://github.com/chenshuo/recipeshttp://github.com/chenshuo/muduo-protorpchttp://github.com/chenshuo/muduo-examples-in-go
Schedule
0. Overview
Measure throughput of TCP over Gigabit Ethernet with netcatLecture section 1 | Lecture section 2 | Lecture section 3
Part I: Basic non-concurrent programs with blocking IO
1. TTCP
Review basic Sockets APIMeasure throughput of TCP over Gigabit Ethernet with TTCPTCP self connectionLecture section 4 | section 5 | section 6 | section 7 | section 8 | section 9
2. Round-trip
How NTP worksMeasure clock error between two hostsThe only UDP exampleLecture section 10 | section 11 | section 12 | section 13 | section 14 | section 15 | section 16
3. Netcat
The Swiss army knife of networkingDeal with two file descriptors simultaneously (stdin/out and TCP socket)Why IO-multiplexing must be used with non-blocking IOLecture section 17 | section 18 | section 19 | section 20 | section 21 | section 22 | section 23
Part II: Concurrent programs with non-blocking IO
4. procmon
cpu / memory usage charts of one processdummyloadLecture section 25 | section 25 | section 26 | section 27 | section 28 | section 29
5. Simple memcached
Customize the data structureEfficient locking by shardingPerformance testingLecture section 30 | section 31 | section 32 | section 33 | section 34 | section 35 | section 36 | section 37 |
6. Sudoku Solver
Request-response modelClient connections are independentConcurrency and parallel on multicore machinesDisable Nagle's algorithm in low-latency serversLoad balancingOverload protectionLecture section 38 | section 39 | section 40 | section 41 | section 42 | section 43 | section 44 | section 45 | section 46 | section 47 | section 48 | section 49 | section 50 |
7. Broadcasting to TCP peers
Connections exchange data with each otherHow to deal with slow clients?Lecture section 51 | section 52 | section 53 | section 54 | section 55 | section 56 |
8. SOCKS proxy server
Relay two TCP connectionsMismatching bandwidth?Difference between level 4 and level 7?Lecture section 57 | section 58 | section 59 | section 60 | section 61 | section 62 | section 63 | section 64 | section 65 | section 66 | section 67 | section 68 |
Part III: Data processing with multiple machines
9. Parallel N-queen puzzle
Multithreaded N-queen puzzleMulti-machine N-queen puzzle using MapReduceLecture section 69 | section 70 | section 71 | section 72 | section 73 | section 74 |
10. Median across machines
Lecture section 75 | section 76 | section 77 | section 78 |
11. Most frequent queries
Lecture section 79 | section 80 | section 81 | section 82 | section 83 | section 84 |