Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> การเขียนโปรแกรม

Service Primitives ใน Computer Network คืออะไร?

Service Primitives (บริการพื้นฐาน)

Operation ที่ Layer ให้ Layer บนเรียกใช้ เพื่อแลกเปลี่ยนข้อมูลกับ Peer Entity

4 ประเภทหลัก

Primitiveความหมายตัวอย่าง
RequestLayer บนขอให้ Layer ล่างทำงาน (ส่งข้อมูล)CONNECT.request, DATA.request
IndicationLayer ล่างแจ้ง Layer บนว่า Peer ทำ Request มาCONNECT.indication, DATA.indication
ResponseLayer บนตอบกลับ Indication (ยอม/ปฏิเสธ)CONNECT.response (Accept/Reject)
ConfirmLayer ล่างแจ้ง Layer บนผลของ Request เดิมCONNECT.confirm (Success/Failed)

Connection-Oriented Service (เช่น TCP, Telephone)

  • CONNECT.request → CONNECT.indication → CONNECT.response → CONNECT.confirm
  • DATA.request → DATA.indication
  • DISCONNECT.request → DISCONNECT.indication

Connectionless Service (เช่น UDP, Postal Mail)

  • DATA.request (ส่งทันที, ไม่ต้อง Connect)
  • DATA.indication (รับทันที)
  • อาจมี REPORT.confirm (Registered Mail - ยืนยันส่งถึง)

Confirmed vs Unconfirmed Services

  • Confirmed: มี Response/Confirm (Connection-Oriented)
  • Unconfirmed: ไม่มี Confirmation (Connectionless, Best Effort)

Parameters ของ Primitives

  • CONNECT: Address, QoS, Options
  • DATA: Buffer, Length, Flags
  • DISCONNECT: Reason Code

ความสัมพันธ์กับ Protocol

Service Primitives = Service Interface (API) ระหว่าง Layer
Protocol = Rules ระหว่าง Peer Entities (Wire Format, State Machine)

Service Definition: "What it does"
Protocol Specification: "How it does it"