Try   HackMD

Linux Network Programming, by WhoAmI

tags: C LANGUAGE linux network programming

Authors: WhoAmI, CrazyMonkey
email: kccddb@gmail.com
Date: 20221217
Copyright: CC BY-NC-SA

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Do your best to be ethical and respect copyright.

這裡的內容 適合 資電大三以上 學過網路, Linux 與 c 語言的人士

開始練習 看 man page 與 良好的程式設計習慣, 例如 MT-Safe(Multi Thread Safe), data type (資料型態)

至於 效能 請 學好 Probability, Statistics, OS and Algorithm 等

c Language:
ANSI C for Programmers on UNIX Systems, Tim Love

C 也可以寫的很OOP 簡單範例與簡易Makefile

putty or MobaXterm

Ubuntu-16.04, VirtualBox

Win32 Editor: Komodo Edit

Learn iproute2
ip addr
ip route

Learn commands:
vim, nano, wget, sudo, cd, ls, cp, cat, more, find, ln, grep, ps, chmod, chown, tar, mkdir, rm, rmdir, df, du, kill, echo, ping, strace, top, strip, route, ifconfig, arp, pstree, touch, netstat, ldd, pstree, objdump, gunzip, gzip, bzip2, dmesg, pwd, which, iptables, brctl, iproute2 ip command

其實我自己較 "懶" shell commands 自己學(其實 也沒時間教)

簡明 Linux Shell Script 入門教學

了解 linux 檔案架構與主要用途

Linux Command Cheat Sheet

資電的練習 看 8051 datasheet, 培養 看 datasheet 的習慣

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

安裝與學習實用的工具軟體: Wireshark

Learn How to Use Wireshark like a PRO

過去我自己的教學慣例: 期末作業是傳4G 的檔案, 要處理 網路斷線多次 (斷電, 拔網路線, 蓋金屬盒子, NMAP), 頻寬不同 並可續傳的 client/server, 事實上實作 不容易, 但學生可以體會很多實務上的問題

注意 傳檔案大小時, 注意 byte order 的問題 ( client/server 會遇到 不同 byte order 問題)

很多 用 ping xx.xx.xx.xx 偵測網路通不通~真的完整嗎? Why? (這問題 對 非通訊電子了解的人士 算難)

ping 可以, 但有時使用不行, 或不穩定

Hint: noise,interference, 接觸不良,

使用 Netstat 指令檢測網路的技巧, by G. T. Wang
7-Zip
網路程式會動很容易, 穩定與效能才是重點

個人 覺得 網路程式設計
最好 星期六 日
10:00~12:00 13:00~16:00
3~4 星期 結束, 可惜 學校不是 如此

學校也可收業界的人士~死腦筋


Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


COURSE OUTLINE


Basic c programming

TCP Client/Server

Process State-fork, exit, wait, signal

C 也可以寫的很OOP 簡單範例與簡易Makefile

Simple OOP TCP server

Interrupt, ISR probrem

select system call-synchronous I/O multiplexing

TCP Client/Server (select) 運作觀念

UDP Client/Server (select)

pthread 的 echo server (注意 有 bug!)

Embedded Linux System, Boot, Linux VFS, System Call, SPI, GPIO, … 課程基礎原理

c language: function pointer, callback and event-driven

*popen, select, PHP client, 執行遠端程式

Sniff frames 設計 tcpdump, Wireshark 基本原理

volatile and optimization 影響效能的關鍵之一

HTTP 1.0 web server+CGI-sample code

Linux I/O redirection

*Pthread Scheduling, Fairness, Power, Performance

*CServer class, callback function, pthread, non-blocking connect simple and basic HTTP server

Application (Linux firewall, QoS and route): Linux iptables and iproute2

SMTP (Simple Mail Transfer Protocol )


有意修習 (或未來)embedded system 課的同學

libusb


Learn commands: (請看 man page)
vim, nano, wget, sudo, cd, ls, cp, cat, more, find, ln, grep, ps, chmod, chown, tar, mkdir, rm, rmdir, df, du, kill, echo, man, top, ping, which, touch, pstree, strace, strip, netstat, lsmod, insmod, rmmod, modinfo, bzip2, gunzip, tcpdump, mount, umount, dd, objdump, gzip, mke2fs, tee, tail, dmesg, reboot, sync, cpio, losetup, strip -g (Remove debugging symbols only),

Linux 匹配文字 grep 指令用法教學與範例, by G. T. Wang

Regular Expression in Linux

Linux Command Cheat Sheet

Nmap-the Network Mapper - Free Security Scanner

Nmap Network Scanning
The Official Nmap Project Guide to Network Discovery and Security Scanning

裡面 有 bzero , 請改用 memset, 可見是 前輩! 自己 SSL 有版權問題 不方便 公開免費使用

應用 例如 學校用 e-mail 認證( DNAT+POP3) Wifi 密碼

ssl server client programming using openssl in c


websocket Theldus/wsServer


以下比較適合 大四 研一

山不在高 有仙則名

安裝arm-2013.11-33-arm-none-linux-gnueabi toolchain 與 小的測試 rootfs, init 給 QEMU

編譯 ARM Busybox 1.22.0 當 Rootfs for QEMU Linux

Linux simple sysfs and procfs demo (Linux kernel >3.2)

Add a system call (in X86 QEMU Environment)