Transcript lec2

The Basics of communication
LectureII
Processing Techniques
The Client  Server Model
 The server roles:
– Give service as asked
– Wait the client to appeal to him
 The client roles:
– Start the communication process
– Asks the wanted service
Design considerations
 Serve single or multiple users
 Use reliable or unreliable protocol
 Software updates
Client and server roles in UDP
 Server roles:
– Bind a port
– Wait for a message to come
– Send reply
 Client roles:
– Send a message
– Get the reply
User Datagram Protocol*
 Simple protocol
 Connectionless
 Unreliable
*{RFC 768}
Socket:={ip_addr, port number}
 API, an interface for the program to contact
with communication.
 Enable usage of regular file commands as
read, write and so on.
 The sockets are structures passed from
kernel to process and vice versa.
What the socket struct contains ?
 Socket type {stream, dgram, raw,…}
 Socket options {broadcast, OOB...}
 Time to linger wait before close the socket
 Socket state flags
 Protocol Control Block
 Protocol Handle
The socket & address structs
 General
struct sockaddr {
uint8_t
sa_len;
of socket struct
*/
sa_family_t sa_family;
as AF_INET
*/
char
sa_data[20];
Address
*/
/*Len
/*Addr family
/*Protocol
 IP V4 address socket
struct sockaddr_in {
uint8_t
socket length
sa_family_t
IP addresses
unit16_t
sin_len;
*/
sin_family;
*/
sin_port;
/*The
/*AF_INET for
/*The
How the socket is created
 The system call passes identifiers for
address family(e.g.AF_UNIX, AF_INET,etc.),
socket type and protocol.
 Socket data structure is allocated.
 Pointer from the fd table to other i-node
struct which points to the socket.
User Datagram Protocol (rfc 768)
 Data transport layer protocol
(Fragment packets to fit local MTU)
 Used to make available datagram packet switched
mode
 Connectionless protocol
 Used when RTT is important or no connection
needed
UDP header
Source port number
(16 bit)
Destination port
number (16 bit)
Length
(16 bit)
UDP Checksum
(16 bit)
Data
UDP by network monitor
Lets do it in UDP - client
C:\TEMP\udp-cli-c.htm
Lets do it in UDP - server
C:\TEMP\udp-srv-c.html