Network Programming Eddie Aronovich mail: eddiea@mta. ac. il
How did it started ?
How can we write communication ? 4 Application Program Interface (API) – Sockets – TLI (Transport Layer Interface) 4 System calls 4 Library functions
What is it for ? Communication systems provides 3 services: – Information & resource Sharing – Distance gapping – Backup abilities
Fundamentals 4 Server - An entity which gives services 4 Client - An entity which requests services 4 Transport layer - To transfer the data
The 7 layers model
The 7 Layer model in real life
TCP Lecture. III
Transmission Control Protocol rfc 793 4 Reliability 4 Sequenced data transfer 4 Flow control 4 Full duplex
TCP Header Source port number (16 bit) Dest port number (16 bit) Sequence number (32 bit) Acknowledgement number (32 bit) FIN SYN RST PSH ACK F. F. U (6 bit) URG Header length (4 bit) TCP Checksum (16 bit) Window size (16 bit) Urgent Pointer (16 bit) Options Data
Ack & Flow control 4 Acknowledgements are sent by byte. 4 The acks can be sent for group of packets (but should arrive before time out of first packet). 4 Window size is used for flow control and is controlled by receiver.
How connection starts ? connect(); connect returns…. SYN j SYN k, ACK j+1 listen(); accept returns…. ACK k+1 Connection Established
How we do it in C ? Server Client socket(); bind(); listen(); accept(); {New file descriptor is given} connect();
Ending Sessions Passive close (FIN arrives) Vs. Active close FIN M ACK M+1 FIN N ACK N+1