Network Programming Eddie Aronovich mail:

Slides:



Advertisements
Similar presentations
Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
Advertisements

TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
CCNA – Network Fundamentals
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
CSE551: Computer Network Review r Network Layers r TCP/UDP r IP.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Networks I Transmission Control Protocol Instituto Tecnológico y de Estudios Superiores de Monterrey Campus Estado de México Prof. MSc. Ivan A. Escobar.
Transmission Control Protocol (TCP) Basics
CS3505 The Internet and Info Hiway transport layer protocols : TCP/UDP.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Computer Networks 2 Lecture 2 TCP – I - Transport Protocols: TCP Segments, Flow control and Connection Setup.
TCP segment structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement number rcvr window size ptr.
Copyright 1999, S.D. Personick. All Rights Reserved. Telecommunications Networking II Lecture 32 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
EEC-484/584 Computer Networks Lecture 15 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
CSEE W4140 Networking Laboratory Lecture 6: TCP and UDP Jong Yul Kim
The Basics of communication LectureII. Processing Techniques.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
Network Programming Eddie Aronovich mail:
IP-UDP-RTP Computer Networking (In Chap 3, 4, 7) 건국대학교 인터넷미디어공학부 임 창 훈.
Gursharan Singh Tatla Transport Layer 16-May
Microsoft Windows Server 2003 TCP/IP Protocols and Services Technical Reference Slide: 1 Lesson 12 Transmission Control Protocol (TCP) Basics.
Process-to-Process Delivery:
The Network Layer. Network Projects Must utilize sockets programming –Client and Server –Any platform Please submit one page proposal Can work individually.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All.
1 LAN Protocols (Week 3, Wednesday 9/10/2003) © Abdou Illia, Fall 2003.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
Copyright 2002, S.D. Personick. All Rights Reserved.1 Telecommunications Networking II Topic 20 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Chapter 6-2 the TCP/IP Layers. The four layers of the TCP/IP model are listed in Table 6-2. The layers are The four layers of the TCP/IP model are listed.
Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 6 The Transport Layer.
Transport Layer3-1 Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
Chapter 2 Applications and Layered Architectures Sockets.
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
Lecture 4 Overview. Ethernet Data Link Layer protocol Ethernet (IEEE 802.3) is widely used Supported by a variety of physical layer implementations Multi-access.
Advanced UNIX programming Fall 2002, lecture 16 Instructor: Ashok Srinivasan Acknowledgements: The syllabus and power point presentations are modified.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
4343 X2 – The Transport Layer Tanenbaum Ch.6.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Cisco I Introduction to Networks Semester 1 Chapter 7 JEOPADY.
Computer Networks 1000-Transport layer, TCP Gergely Windisch v spring.
Process-to-Process Delivery:
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
SOCKET PROGRAMMING Presented By : Divya Sharma.
Introduction to Networks
Chapter 11 User Datagram Protocol
The Transport Layer Implementation Services Functions Protocols
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Introduction to TCP/IP
5. End-to-end protocols (part 1)
Transport Layer.
Process-to-Process Delivery, TCP and UDP protocols
TCP/IP Transmission Control Protocol / Internet Protocol
Net 221D : Computer Networks Fundamentals
Socket Programming in C
Introduction to Networks
Process-to-Process Delivery:
PART 5 Transport Layer.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Chapter 5 Transport Layer Introduction
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Transport Layer 9/22/2019.
Presentation transcript:

Network Programming Eddie Aronovich mail:

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

The message is built in one side...

And striped in the dest. side…

From Lynx to Netscape or chat client Presentation

Descriptors 4 Everything in Unix is a file 4 Descriptor is an index into an array

Memory Buffers 4 Contains Socket Address Structure 4 Headers 4 Data

The Basics of communication LectureII

Processing Techniques

The Client  Server Model 4 The server roles: –Give service as asked –Wait the client to appeal to him 4 The client roles: –Start the communication process –Asks the wanted service

Design considerations 4 Serve single or multiple users 4 Use reliable or unreliable protocol 4 Software updates

Client and server roles in UDP 4 Server roles: –Bind a port –Wait for a message to come –Send reply 4 Client roles: –Send a message –Get the reply

User Datagram Protocol* 4 Simple protocol 4 Connectionless 4 Unreliable *{RFC 768}

Socket:={ip_addr, port number} 4 API, an interface for the program to contact with communication. 4 Enable usage of regular file commands as read, write and so on. 4 The sockets are structures passed from kernel to process and vice versa.

What the socket struct contains ? 4 Socket type {stream, dgram, raw,…} 4 Socket options {broadcast, OOB...} 4 Time to linger wait before close the socket 4 Socket state flags 4 Protocol Control Block 4 Protocol Handle

The socket & address structs  General struct sockaddr { uint8_tsa_len; /*Len of socket struct */ sa_family_tsa_family; /*Addr family as AF_INET */ charsa_data[20];/*Protocol Address*/  IP V4 address socket struct sockaddr_in { uint8_t sin_len; /*The socket length */ sa_family_tsin_family;/*AF_INET for IP addresses*/ unit16_t sin_port;/*The port id 16-bit port num */ structin_addr sin_addr;/*The IP address 32-bit */ charsin_zero [8]; /* FFU - Must be zero */

How the socket is created 4 The system call passes identifiers for address family(e.g. AF_UNIX, AF_INET,etc.), socket type and protocol. 4 Socket data structure is allocated. 4 Pointer from the fd table to other i-node struct which points to the socket.

User Datagram Protocol (rfc 768) 4 Data transport layer protocol (Fragment packets to fit local MTU) 4 Used to make available datagram packet switched mode 4 Connectionless protocol 4 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

TCP LectureIII

Transmission Control Protocol rfc 793 rfc 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) Header length (4 bit) F.F.U (6 bit) URGACK PSHRST SYN FIN Window size (16 bit) TCP Checksum (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();listen(); connect returns…. accept(); accept returns…. SYN j SYN k, ACK j+1 Connection Established ACK k+1

How we do it in C ? ServerClient socket(); bind(); connect(); listen(); accept(); {New file descriptor is given}

Ending Sessions Passive close (FIN arrives) Vs. Active close FIN M ACK M+1 FIN N ACK N+1

Internet Protocol LectureIV

Network Layer 4 Passing packet from source host to destination host (cross networks if needed) 4 Independent of the datalink layer 4 QoS 4 Flow control

Internet Protocol 4 Connectionless 4 Unreliable 4 Best effort

Address 4 IP address consist 32bit and is divided into {network id.,host id} 4 Part of host id can be used for subnet mask 4 Some special addresses are defined (as: net- addr, broadcast-addr, multicast-addr)

Addresses and Classes Class A Addresses: X.X.X Class B Addresses: X.X Class C Addresses: X 01XXXXXX 10XXXXXX 110XXXXX

Masks 4 Mask is used to refine network division. 4 ‘1’b in mask symbolize bit belongs to network address. 4 ‘0’b in mask symbolize bit belongs to host address.

Address conventions 4 Network address filled with ‘0’ in host address. 4 Broadcast address filled with ‘1’ in host address. 4 First, last subnet and address aren’t used

How routing is done ? 4 The router compares destination IP with each Network & subnet address. 4 Unknown destination is routed to default. 4 Routers update each other with appropriate algorithms.

VI שיעור I/O Multiplexing

I/O Models 4 Blocking I/O 4 Nonblocking I/O 4 I/O Multiplexing 4 Signal driven 4 Asynchronous I/O

Non-Blocking I/O 4 No blocking is done (Error is returned) 4 Reading is done in loop (until data arrives) 4 Polling – costs CPU time 4 Implementation in real time systems only

Signal Driven I/O 4 Signal handler should be started