Basic Networking Vivek Pai Nov 26, 2002. 2 Communication  You’ve already seen some of it –Web server project(s)  Machines have “names” –Human-readable.

Slides:



Advertisements
Similar presentations
Introduction to Sockets Jan Why do we need sockets? Provides an abstraction for interprocess communication.
Advertisements

CS 4700 / CS 5700 Network Fundamentals
Chapter 17 Networking Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Taekyung Kim 0x410 ~ 0x International Standards Organization (ISO) is a multinational body dedicated to worldwide agreement on international.
Review: –What functionality is supported by IP? –What IP does not do? –How many classes of IP addresses? –Explain fields in an IP header? –How subnet works?
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.
Fast Communication Firefly RPC Lightweight RPC  CS 614  Tuesday March 13, 2001  Jeff Hoy.
Quick Overview. 2 ISO/OSI Reference Model Application Application Presentation Presentation Session Session Transport Transport Network Network Data Link.
1 Java Networking – Part I CS , Spring 2008/9.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
Networking Support In Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Client Server Model The client machine (or the client process) makes the request for some resource or service, and the server machine (the server process)
Basic Networking & Interprocess Communication Vivek Pai Nov 27, 2001.
Sockets COS 518: Advanced Computer Systems Michael Freedman Fall
Gursharan Singh Tatla Transport Layer 16-May
UNIX Sockets COS 461 Precept 1. Clients and Servers Client program – Running on end host – Requests service – E.g., Web browser Server program – Running.
1 Tutorial on Socket Programming Computer Networks - CSC 458 Department of Computer Science Yukun Zhu (Slides are mainly from Monia Ghobadi, and Amin Tootoonchian,
TCP Sockets Reliable Communication. TCP As mentioned before, TCP sits on top of other layers (IP, hardware) and implements Reliability In-order delivery.
UNIX Sockets COS 461 Precept 1.
Socket Programming -What is it ? -Why bother ?. Basic Interface for programming networks at transport level It is communication end point Used for inter.
1 Networking (Stack and Sockets API). 2 Topic Overview Introduction –Protocol Models –Linux Kernel Support TCP/IP Sockets –Usage –Attributes –Example.
Network Programming Tutorial #9 CPSC 261. A socket is one end of a virtual communication channel Provides network connectivity to any other socket anywhere.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
University of Calgary – CPSC 441.  UDP stands for User Datagram Protocol.  A protocol for the Transport Layer in the protocol Stack.  Alternative to.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
1 Semester 2 Module 10 Intermediate TCP/IP Yuda college of business James Chen
LWIP TCP/IP Stack 김백규.
IT COOKBOOK Windows Network Programming. Chapter 01. Intro. to Network and Socket Programming.
1 7-Oct-15 OSI transport layer CCNA Exploration Semester 1 Chapter 4.
1 The Internet and Networked Multimedia. 2 Layering  Internet protocols are designed to work in layers, with each layer building on the facilities provided.
Routers and Routing Basics CCNA 2 Chapter 10.
Chapter 4: Interprocess Communication‏ Pages
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.
Remote Shell CS230 Project #4 Assigned : Due date :
4061 Session 25 (4/17). Today Briefly: Select and Poll Layered Protocols and the Internets Intro to Network Programming.
TCP Sockets Reliable Communication. TCP As mentioned before, TCP sits on top of other layers (IP, hardware) and implements Reliability In-order delivery.
Networking Fundamentals. Basics Network – collection of nodes and links that cooperate for communication Nodes – computer systems –Internal (routers,
Advanced Sockets API-II Vinayak Jagtap
1 Computer Networks An Introduction to Computer Networks University of Tehran Dept. of EE and Computer Engineering By: Dr. Nasser Yazdani Lecture 3: Sockets.
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
UNIX Sockets COS 461 Precept 1. Socket and Process Communication The interface that the OS provides to its networking subsystem application layer transport.
Networking Basics CCNA 1 Chapter 11.
Socket Programming Lab 1 1CS Computer Networks.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Today’s topic: UDP Reliable communication over UDP.
Network Layer (OSI and TCP/IP) Lecture 9, May 2, 2003 Data Communications and Networks Mr. Greg Vogl Uganda Martyrs University.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
Cisco Confidential © 2013 Cisco and/or its affiliates. All rights reserved. 1 Cisco Networking Training (CCENT/CCT/CCNA R&S) Rick Rowe Ron Giannetti.
Socket Programming. Computer Science, FSU2 Interprocess Communication Within a single system – Pipes, FIFOs – Message Queues – Semaphores, Shared Memory.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
1 Network Communications A Brief Introduction. 2 Network Communications.
1 14-Jun-16 S Ward Abingdon and Witney College CCNA Exploration Semester 1 OSI transport layer CCNA Exploration Semester 1 Chapter 4.
Sockets Intro to Network Programming. Before the internet... Early computers were entirely isolated No Internet No network No model No external communications.
© 2006 Cisco Systems, Inc. All rights reserved.Cisco Public 1 OSI transport layer CCNA Exploration Semester 1 – Chapter 4.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
Network Models. 2.1 what is the Protocol? A protocol defines the rules that both the sender and receiver and all intermediate devices need to follow,
SOCKET PROGRAMMING Presented By : Divya Sharma.
Chapter 9: Transport Layer
Instructor Materials Chapter 9: Transport Layer
CSCE 313 Network Socket MP8 DUE: FRI MAY 5, 2017
UNIX Sockets COS 461 Precept 1.
Socket Programming in C
Socket Programming in C
Chapter 2 Application Layer
CSCD 330 Network Programming
Presentation transcript:

Basic Networking Vivek Pai Nov 26, 2002

2 Communication  You’ve already seen some of it –Web server project(s)  Machines have “names” –Human-readable names are convenience –“Actual” name is IP (Internet Protocol) address –For example, means “this machine” –nslookup gives www.cs.princeton.edu

3 Names & Services  Multiple protocols –ssh, ftp, telnet, http, etc. –How do we know how to connect?  Machines also have port numbers –16 bit quantity ( ) –Protocols have default port # –Can still do “telnet ”

4 But The Web Is Massive  Possible names >> possible IP addresses –World population > possible IP addresses –Many names map to same IP addr –Use extra information to disambiguate –In HTTP, request contains “Host: name” header  Many connections to same (machine, port #) –Use (src addr, src port, dst addr, dst port) to identify connection

5 Measuring Latency  Here to Berkeley, CA  Mapquest: 2898 miles (47 hours driving)  Speed of light: miles/sec –15.6 ms (slightly slower than a disk access)  Ping: –84ms round trip (less than 3x slower)  Why? Packet switching

6 Circuit Switching versus Packet Switching  Circuit – reserve resources in advance –Hold resources for entire communication –Example: phone line  Packet – break data into small pieces –Pieces identify themselves, “share” links –Individual pieces routed to destination –Example: internet –Problem: no guarantee pieces reach

7 Mapping Packet Switching % traceroute traceroute to hyperion.cs.berkeley.edu ( ), 64 hops max, 40 byte packets 1 * * * 2 csgate.CS.Princeton.EDU ( ) ms ms ms 3 vgate1.Princeton.EDU ( ) ms ms ms 4 local.princeton.magpi.net ( ) ms ms ms 5 remote1.abilene.magpi.net ( ) ms ms ms 6 nycmng-washng.abilene.ucaid.edu ( ) ms ms ms 7 chinng-nycmng.abilene.ucaid.edu ( ) ms ms ms 8 iplsng-chinng.abilene.ucaid.edu ( ) ms ms ms 9 kscyng-iplsng.abilene.ucaid.edu ( ) ms ms ms 10 snvang-kscyng.abilene.ucaid.edu ( ) ms ms ms 11 snva-snvang.abilene.ucaid.edu ( ) ms ms ms ( ) ms ms ms 13 BERK--SUNV.POS.calren2.net ( ) ms ms ms 14 pos1-0.inr-000-eva.Berkeley.EDU ( ) ms ms ms 15 vlan199.inr-202-doecev.Berkeley.EDU ( ) ms ms ms 16 doecev-soda-br-6-4.EECS.Berkeley.EDU ( ) ms ms ms 17 hyperion.CS.Berkeley.EDU ( ) ms ms ms

8 Abilene (Internet2) Nodes

9 Failure Behavior  What happens if –We send the packet –It reaches Sunnyvale –It meanders to Berkeley –Web server loses power  Can we avoid this situation?

10 The “End To End” Argument  Don’t rely on lower layers of the system to ensure something happens  If it needs to occur, build the logic into the endpoints  Implications: –Intermediate components simplified –Repetition possible at endpoints (use OS)  What is reliability?

11 Do Applications Care?  Some do  Most don’t –Use whatever OS provides –Good enough for most purposes  What do applications want? –Performance –Simplicity

12 Reading & Writing  A file: –Is made into a “descriptor” via some call –Is an unstructured stream of bytes –Can be read/written –OS provides low-level interaction –Applications use read/write calls  Sounds workable?

13 Kernel Internals int read(struct proc *p, struct read_args *uap) { register struct file *fp; int error; if ((fp = holdfp(p->p_fd, uap->fd, FREAD)) == NULL) return (EBADF); error = dofileread(p, fp, uap->fd, uap->buf, uap->nbyte, (off_t)-1, 0); fdrop(fp, p); return(error); }

14 Kernel Internals int dofileread(struct proc *p, struct file *fp, int fd, flags, void *buf, size_t nbyte, off_t offset) { […] (elided some code here) cnt = nbyte; if ((error = fo_read(fp, &auio, fp->f_cred, flags, p))) { if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) error = 0; } cnt -= auio.uio_resid; p->p_retval[0] = cnt; return (error); }

15 Kernel Internals static __inline int fo_read(struct file *fp, struct uio *uio, struct ucred *cred, struct proc *p, int flags) { int error; fhold(fp); error = (*fp->f_ops->fo_read)(fp, uio, cred, flags, p); fdrop(fp, p); return (error); }

16 Who Are These People

17 Gary Kildall  Founded Intergalactic Digital Research  Wrote CP/M –Fairly portable –Wide use before IBM PC –Sales of $5.1M in 1981 –Almost became PC’s OS  Died in 1994 from head injuries

18 Network Connections As FDs  Network connection usually called “socket”  Interesting new system calls –socket( ) – creates an fd for networking use –connect( ) – connects to the specified machine –bind( ) – specifies port # for this socket –listen( ) – waits for incoming connections –accept( ) – gets connection from other machine  And, of course, read( ) and write( )

19 New Semantics  Doing a write( ) –What’s the latency/bandwidth of a disk? –When does a write( ) “complete”? –Where did data actually go before? –Can we do something similar now?  What about read( ) –Is a disk read different from a network read? –When should a read return? –What should a read return?

20 Buffering  Provided by OS –Memory on both sender and receiver sides –Sender: enables reliability, quick writes –Receiver: allows incoming data before read  Example – assume slow network –write(fd, buf, size); –memset(buf, 0, size) –write(fd, buf, size);

21 Interprocess Communications  Shared memory –Threads sharing address space –Processes memory-mapping the same file –Processes using shared memory system calls  Sockets and read/write –Nothing prohibits connection to same machine –Even faster mechanism – different “domain” –Unix domain (local) versus Internet (either)

22 Sockets vs Shared Memory  Sockets –Higher overhead –No common parent/file needed –“Active” operation – under program control  Shared memory –Locking due to synchronous operation –Fast reads/writes – no OS intervention –Harder to use multiple machines