Introduction to Socket Programming - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Introduction to Socket Programming

Description:

socklen_t cli_len = sizeof(cli); /* used by accept ... cli.sin_addr.s_addr contains the client's IP address. cli.sin_port contains the client's port number ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 51
Provided by: csieN
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Socket Programming


1
Introduction to Socket Programming
  • Yen-Nien Wu
  • CSIE, NTU

2
Outline
  • Background
  • What is a socket?
  • TCP vs. UDP
  • Byte Ordering
  • Socket I/O
  • TCP/UDP Client and Server
  • I/O multiplexing
  • HW 1 Web Proxy

3
Server and Client
Server and Client exchange messages over the
network through a common Socket API
Clients
Server
ports
user space
TCP/UDP
TCP/UDP
kernel space
Socket API
IP
IP
Ethernet Adapter
Ethernet Adapter
hardware
4
User Datagram Protocol(UDP) An Analogy
  • Postal Mail
  • Single mailbox to receive messages
  • Unreliable ?
  • Not necessarily in-order delivery
  • Each letter is independent
  • Must address each reply
  • Postal Mail
  • Single mailbox to receive letters
  • Unreliable ?
  • Not necessarily in-order delivery
  • Letters sent independently
  • Must address each reply
  • UDP
  • Single socket to receive messages
  • No guarantee of delivery
  • Not necessarily in-order delivery
  • Datagram
Write a Comment
User Comments (0)
About PowerShow.com