Starting TCP Connection – A High Level View

Slides:



Advertisements
Similar presentations
Sockets Programming Network API Socket Structures Socket Functions
Advertisements

Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
HTTP Cookies. CPSC Application Layer 2 User-server state: cookies Many major Web sites use cookies Four components: 1) cookie header line of HTTP.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 Network Services Networking for Home and Small Businesses – Chapter 6.
1 Java Networking – Part I CS , Spring 2008/9.
The Transport Layer Chapter 6. The Transport Service Services Provided to the Upper Layers Transport Service Primitives Berkeley Sockets An Example of.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
Networks: HTTP and DNS1 Internet, HTTP and DNS Examples.
1 School of Computing Science Simon Fraser University CMPT 771/471: Internet Architecture and Protocols Socket Programming Instructor: Dr. Mohamed Hefeeda.
1 CCNA 2 v3.1 Module Intermediate TCP/IP CCNA 2 Module 10.
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
The Transport Layer.
Network Programming Tutorial #9 CPSC 261. A socket is one end of a virtual communication channel Provides network connectivity to any other socket anywhere.
1 Semester 2 Module 10 Intermediate TCP/IP Yuda college of business James Chen
TCP/IP: Basics1 User Datagram Protocol (UDP) Another protocol at transport layer is UDP. It is Connectionless protocol i.e. no need to establish & terminate.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae, VUW Networking COMP # 21.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.

 TCP (Transport Control Protocol) is a connection-oriented protocol that provides a reliable flow of data between two computers.  TCP/IP Stack Application.
The Inter-network is a big network of networks.. The five-layer networking model for the internet.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
Distributed Computing A Programmer’s Perspective.
Multimedia and Networks. Protocols (rules) Rules governing the exchange of data over networks Conceptually organized into stacked layers – Application-oriented.
Presented by Rebecca Meinhold But How Does the Internet Work?
Networking Basics CCNA 1 Chapter 11.
Chapter 27 Socket API Interface The interface between an application program and the communication protocols in an operating system is known as the Application.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
Socket Programming.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
© 2002, Cisco Systems, Inc. All rights reserved..
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Java’s networking capabilities are declared by the classes and interfaces of package java.net, through which Java offers stream-based communications that.
1 Network Communications A Brief Introduction. 2 Network Communications.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Network Programming. These days almost all devices.
Chapter 9 The Transport Layer The Internet Protocol has three main protocols that run on top of IP: two are for data, one for control.
The Echo Server Problem. Contents  Basic Networking Concepts  The Echo Server Problem.
SOCKET PROGRAMMING Presented By : Divya Sharma.
iperf a gnu tool for IP networks
COMP2322 Lab 4 Socket Programming
Echo Networking COMP
Application layer tcp/ip
Sockets and Beginning Network Programming
Client-Server Model and Sockets
Networking COMP
MCA – 405 Elective –I (A) Java Programming & Technology
Socket Programming Cal Poly Pomona Young CS380.
Internet Networking recitation #12
Socket Interface 1 Introduction 11 Socket address formats 2 API 12 13
Client-Server Interaction
Topic 5: Communication and the Internet
Sarah Diesburg Operating Systems COP 4610
The Internet and HTTP and DNS Examples
I. Basic Network Concepts
Network Programming CSC- 341
Multimedia and Networks
Process-to-Process Delivery:
CPEG514 Advanced Computer Networkst
CSCD 330 Network Programming
TA: Donghyun (David) Kim
ECE 4450:427/527 - Computer Networks Spring 2017
Internet Applications & Programming
INFORMATION FLOW ACROSS THE INTERNET
Kyle Broussard, Alexandra Mikolai,
Computer Networks Protocols
Transport Layer 9/22/2019.
Exceptions and networking
Presentation transcript:

Starting TCP Connection – A High Level View Server set-up The server application opens a TCP socket for listening on port 80. listen(socket, …) Socket sendto(socket, …) recvfrom(socket, …) shutdown(socket, …) … The operating system returns a socket that can be used for listening. The application listens for new connections. Connection set-up The client application opens a TCP socket to a destination IP address and destination port. TCP in the client operating system sends a packet to the destination IP address and port. The packet arrives at the server. Socket Internet

Starting TCP Connection – High Level View Server set-up Connection set-up (continued) The server application opens a TCP socket for listening on port 80. The networking protocol stack in the server operating system receives this packet and, since an application is listening on this destination port, TCP sends a response back to the client. The operating system returns a socket that can be used for listening. The application listens for new connections. Connection set-up The client application opens a TCP socket to a destination IP address and destination port. TCP in the client operating system sends a packet to the destination IP address and port. The packet arrives at the server. Socket Internet

Starting TCP Connection – High Level View Server set-up Connection set-up (continued) The server application opens a TCP socket for listening on port 80. The networking protocol stack in the server operating system receives this packet and, since an application is listening on this destination port, TCP sends a response back to the client. The operating system returns a socket that can be used for listening. The application listens for new connections. When the response arrives at the client, the operating system Connection set-up Generates a socket that is given to the client application. The client application opens a TCP socket to a destination IP address and destination port. Sends another response back to the server. TCP in the client operating system sends a packet to the destination IP address and port. When the response from the client is received by the server, a socket is generated and given to the listening application. The packet arrives at the server. Socket Socket Socket Internet

Starting TCP Connection – High Level View Connection set-up … The client has a socket for communicating with the server. The server has a socket for communicating with the client. Socket Socket Socket Internet

Starting TCP Connection – High Level View Connection set-up Communicating over TCP … Application calls an operating system function to send data: The client has a socket for communicating with the server. send(socket, data, ….) The server has a socket for communicating with the client. The networking stack makes a packet; And sends the packet to the destination. When the packet arrives, the data can be retrieved using an operating system function: recv(socket, buffer) And so on (with these sockets, data can be sent in either direction). Socket Socket Socket Internet

TCP Connection: Questions How many packets are exchanged before the server can send data to the client? Does the client or server send the first packet? The client. In all protocols, the client starts the transaction Three. The client sends the first packet. The server responds. The client sends a response to the server response. When this response from the client is received, the server application gets a socket. This socket can be used to send and receive data. What information does the client provide to the OS when starting a connection? How many sockets does the server use? The destination address One socket for listening and one socket for each connection The destination port If a web server received three connections, then four sockets have been used. Socket Socket Socket Internet

The 5-Tuple Socket Socket Socket Internet When the packet arrives at the server, how does the networking stack know which application gets the packet? The protocol (TCP)? No. There might be many TCP connections to the server. The destination IP? No. All packets that arrive at the server will have this destination IP address. The destination port? No. All packets to the web server will have this destination port? The source IP? No. The web browser might be downloading multiple web objects at the same time. The source port? No. Other browsers on other machines might use the same port. All 5. The 5-tuple: destination IP, destination port, source IP, source port, protocol Socket Socket Socket Internet

The 5-Tuple Socket Socket Socket Internet The server is listening on port 80 That is: The client uses port 23421 The server controls which port it will use. How are these ports assigned? The client cannot control which port it will use. When the client application requests to make a connection to the server, it specifies the destination IP and the destination port. Server When the web server application makes a socket, it tells the OS the port it will use. If this port is already in use, the request to get a socket for the port will fail. The server port must be known to the client. Many ports are used for specific applications: Client When the client connects to the server, the OS will assign an available port to the connection. Web servers: 80, SSH: 22, Email: 25 https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers Socket Socket Socket Internet

The 5-Tuple Socket Socket Socket Internet When the packet arrives at the server, how does the networking stack know which socket gets the packet? The protocol (TCP)? No. There might be many TCP connections to the server. The destination IP? No. All packets that arrive at the server will have this destination IP address. The destination port? No. All packets to the web server will have this destination port. The source IP? No. The web browser might be downloading multiple web objects at the same time. The source port? No. Other browsers on other machines might use the same port. All 5. The 5-tuple: destination IP, destination port, source IP, source port, protocol. Socket Socket Socket Internet

Can another server process on machine 74.125.115.99 use port 80? Further Questions Can another application (e.g., another browser) on machine 128.174.13.63 also use TCP port 23421? No. The OS will give a different port to each client process. Can another server process on machine 74.125.115.99 use port 80? Yes. A web server can handle many connections at the same time, and each connection will have a socket and use port 80. Web servers can even have many processes listening on the same port waiting for a new connection. But each connection is assigned to exactly one socket.

Starting UDP Connection – A High Level View Server set-up The server application opens a UDP socket for listening on port 10000. The operating system returns a socket that can be used for sending and receiving UDP messages. Client set-up The client application opens a UDP socket for listening on port 10001. The operating system returns a socket that can be used for sending and receiving UDP messages. Socket Socket Internet

Communicating with UDP Server set-up Communicating with UDP The server application opens a UDP socket for listening on port 10000. The client application calls a function to send a message to the server. The operating system returns a socket that can be used for sending and receiving UDP messages. sendto(socket, …) The network stack makes the message and sends it into the Internet. Client set-up The message arrives at the server. The client application opens a UDP socket for listening on port 10001. The server application can retrieve the message from the operating system. The operating system returns a socket that can be used for sending and receiving UDP messages. recfrom(socket,…) Messages can be sent in both directions. Socket Socket Internet

Using TCP vs. Using UDP Socket Socket Internet TCP requires a connection to be set up before any data is sent. UDP requires no connection set-up before data is exchanged. Before any data is sent, the network stacks in the client machine and the server machine exchange messages. Implications When the message is sent, one can be reasonably hopeful that the message will arrive at the destination. When the message is sent, there is no prior indication that the server is ready to receive the message. The operating system returns a socket that can be used for sending and receiving TCP messages. TCP takes longer to set-up. UDP is faster to set-up. Sockets Besides the listening sockets, each socket is for a single connection between a client and server. Each socket is for a port. Data can be sent to and received from any other machine. Socket Socket Internet