การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต
ใช้เครื่องมือ Linux สมัยใหม่เพื่อแสดงพอร์ตที่เปิดอยู่ การเชื่อมต่อที่กำลังทำงาน และกระบวนการเบื้องหลัง เพื่อทำความเข้าใจว่าเครื่องของคุณกำลังสื่อสารกับสิ่งใด
การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต เป็นบทเรียน Linux Networking & TCP/IP for Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Linux Networking & TCP/IP for Developers และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Linux Networking & TCP/IP for Developers มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Why Inspect Connections?
Knowing which ports are open and which connections are live is key to debugging services, catching unexpected traffic, and confirming an app listens where you expect.
Meet ss
The modern tool for socket inspection is ss (socket statistics). It replaces older netstat and runs far faster on busy systems.
ssListening Ports
To see what's listening, stack flags: -l listening, -t TCP, -u UDP, -n numeric. Together: ss -tuln.
ss -tulnWhich Process Owns a Port
Add -p to reveal the process behind each socket — the fast answer to "what is using port 8080?"
sudo ss -tulnpActive Connections
Drop -l to see established connections instead of listeners — who your machine is actually talking to right now.
ss -tn state establishedFiltering by Port
ss takes powerful filters. Target a single port — like :443 — to focus only on HTTPS traffic.
ss -tn dport = :443Connection States
TCP sockets cycle through states like LISTEN, ESTABLISHED, TIME-WAIT, and CLOSE-WAIT. Plenty of CLOSE-WAIT often means an app isn't closing sockets.
Counting Connections
Pipe ss into wc -l to count connections — a quick way to spot connection leaks or rising load.
ss -tn state established | wc -lQuick Port Check With lsof
lsof lists open files, including network sockets. Run sudo lsof -i :8080 for a fast, targeted per-port lookup.
sudo lsof -i :8080Summary Statistics
ss -s prints a one-line summary of socket counts by type and state — a fast health glance for a server.
ss -sResolving Names
Drop the -n and ss resolves host and service names — friendlier to read, but slower on busy hosts.
ss -tuQuick Check
Test your socket-inspection knowledge.
Recap
Recap: ss is the fast modern tool — ss -tuln lists listeners, -p finds owning processes, and lsof -i gives quick per-port lookups.
เรียนรู้ Linux Networking & TCP/IP for Developers ด้วย AI tutor — ฟรี
เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป
- คอร์ส
- 12
- บทเรียน
- 48
คำถามที่พบบ่อย
บทเรียน “การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Linux Networking & TCP/IP for Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Linux Networking & TCP/IP for Developers มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต”
ใช้เครื่องมือ Linux สมัยใหม่เพื่อแสดงพอร์ตที่เปิดอยู่ การเชื่อมต่อที่กำลังทำงาน และกระบวนการเบื้องหลัง เพื่อทำความเข้าใจว่าเครื่องของคุณกำลังสื่อสารกับสิ่งใด คุณปฏิบัติ Linux Networking & TCP/IP for Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Linux Networking & TCP/IP for Developers หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Linux Networking & TCP/IP for Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Linux Networking & TCP/IP for Developers นี้ได้ไหม
ได้ บทเรียน Linux Networking & TCP/IP for Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- พื้นฐานเครือข่าย Linux
- คำสั่งเครือข่ายเบื้องต้น
- ส่วนติดต่อเครือข่ายและ IP
- การตรวจสอบการเชื่อมต่อเครือข่ายและซ็อกเก็ต