CSI 4118 – UNIVERSITY OF OTTAWA

Slides:



Advertisements
Similar presentations
CSC383 Computer Networks Dr. Allen M. Johnson, Jr.
Advertisements

Socket Programming By Ratnakar Kamath. What Is a Socket? Server has a socket bound to a specific port number. Client makes a connection request. Server.
COP 4930 Computer Network Projects Summer C 2004 Prof. Roy B. Levow Lecture 1.
Alogrithm Analysis 實踐資管 Wang-Jiunn Cheng 2004 PART II Signals, Media, and Data Transmission.
Socket Programming.
1 Creating a network app Write programs that  run on different end systems and  communicate over a network.  e.g., Web: Web server software communicates.
The Internet Useful Definitions and Concepts About the Internet.
1 Java Networking – Part I CS , Spring 2008/9.
CSCI 4550/8556 Computer Networks Comer, Chapter 3: Network Programming and Applications.
1 Overview r Socket programming with TCP r Socket programming with UDP r Building a Web server.
Java sockets. From waiting.
Projekt współfinansowany przez Unię Europejską w ramach Europejskiego Funduszu Społecznego „Networking”
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
Process-to-Process Delivery:
1 Ch 3. Network Programming. 2 Network Programming (1)  Network allows arbitrary applications to communicate E.g., client-server computing such as WEB.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
70-291: MCSE Guide to Managing a Microsoft Windows Server 2003 Network Chapter 3: TCP/IP Architecture.
NET0183 Networks and Communications Lecture 31 The Socket API 8/25/20091 NET0183 Networks and Communications by Dr Andy Brooks Lecture powerpoints from.
1 Computer Networks DA Chapter 1-3 Introduction.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Component 9 – Networking and Health Information Exchange Unit 1-1 ISO Open Systems Interconnection (OSI) This material was developed by Duke University,
1 Version 3.0 Module 11 TCP Application and Transport.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
TCP/IP Transport and Application (Topic 6)
RGEC MEERUT(IWT CS703) 1 Java Networking RGEC Meerut.
Practicum: - Client-Server Computing in Java Fundamental Data Structures and Algorithms Margaret Reid-Miller 13 April 2004.
Dr. John P. Abraham Professor University of Texas Pan American Internet Applications and Network Programming.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
2: Application Layer1 Chapter 2: Application layer r 2.1 Principles of network applications r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail  SMTP,
VII. Sockets. 1. What is a Socket? A socket is one end-point of a two-way communication link between two programs running on the network. Socket classes.
TCP/IP (Transmission Control Protocol / Internet Protocol)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Computer Networks & PROTOCOLS (CSI 4118) FALL 2005 Professor Robert L. Probert.
Part 4: Network Applications Client-server interaction, example applications.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
TCP/IP Protocol Stack IP Device Drivers TCPUDP Application Sockets (Gate to network) TCP: –Establish connection –Maintain connection during the communication.
1 Computer Networks and Internets. 2 Internet Growth.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
1 COMP 431 Internet Services & Protocols Client/Server Computing & Socket Programming Jasleen Kaur February 2, 2016.
1 Network Communications A Brief Introduction. 2 Network Communications.
Lecture 4 : Network Architectures (cont..) 1. 2 Summary of OSI Layers.
Network Programming. These days almost all devices.
11/18/2016Basic TCP/IP Networking 1 TCP/IP Overview Basic Networking Concepts.
LESSON Networking Fundamentals Understand TCP/IP.
Instructor Materials Chapter 5 Providing Network Services
Network Programming in Java CS 1111 Ryan Layer May 3, 2010
Networking COMP
Chapter 3 Internet Applications and Network Programming
MCA – 405 Elective –I (A) Java Programming & Technology
Lecture 6: TCP/IP Networking By: Adal Alashban
Internetworking & Address Resolution
CSI 4118 – UNIVERSITY OF OTTAWA
Client-Server Interaction
„Networking”.
Multimedia and Networks
Socket programming - Java
Process-to-Process Delivery:
Lecture 6: TCP/IP Networking 1nd semester By: Adal ALashban.
1 TRANSMISSION CONTROL PROTOCOL / INTERNET PROTOCOL (TCP/IP) K. PALANIVEL Systems Analyst, Computer Centre Pondicherry University, Puducherry –
Protocol Application TCP/IP Layer Model
Chapter 7 Network Applications
OSI Reference Model Unit II
Computer Networks DA2402.
Process-to-Process Delivery: UDP, TCP
OSI Model 7 Layers 7. Application Layer 6. Presentation Layer
TCP/IP Sockets in Java: Practical Guide for Programmers
UDP Principles (Chapter 24) (User Datagram Protocol)
CS18000: Problem Solving and Object-Oriented Programming
Exceptions and networking
Presentation transcript:

CSI 4118 – UNIVERSITY OF OTTAWA Introduction Computer Networks & Protocols Dr. R.L. Probert, SITE, University of Ottawa FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Part I Introduction FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Topic and Scope Computer networks and internets: an overview of concepts, terminology, and technologies that form the basis for digital communication in private corporate networks and the global Internet. FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA You Will Learn Internets and Internetworking Motivation and concept Internet Protocol (IP) datagram format and addressing Internet routers and routing Address binding (ARP) Internet control messages (ICMP) User Datagram Protocol (UDP) Transmission Control Protocol (TCP) Protocol ports and demultiplexing FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

You Will Learn (continued) Some network applications! Client-server paradigm Domain name system (DNS) File transfer (FTP) Remote login (TELNET) Email transfer (SMTP) Web technologies and protocols HTTP, CGI, Java Security Voice over IP, … FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Background Required Ability to program in Java, ability to read C code Knowledge of low-level programming constructs Pointers Bit fields in structures Familiarity with basic tools Text editor Compiler / linker / loader FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Background Required (continued) Basic knowledge of operating systems Terminology Functionality Processes and concurrent processing CSI 3103/3503 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Motivation for Networking Information access Interaction among cooperative application programs Resource sharing FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA The Internet Concept The illusion of a single network that TCP/IP software provides to users and applications User’s computers FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA The Internet Concept The underlying physical structure in which a computer attaches to one physical network and routers interconnect the networks Net 2 Net 1 Net 1 Net 4 Net 3 Net 5 Router Physical net FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Figure 2.1 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Figure 2.2 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Figure 2.3 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Figure 2.4 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Figure 2.5 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Figure 2.6 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Practical Examples E-mail File transfer / access Web browsing Remote login / execution FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA What is a Network? Transmission hardware (media) [Ch. 4] Special-purpose hardware devices [Ch. 9, 10] Interconnect transmission media Control transmission Run protocol software Protocol software [Ch. 16 and following] Encodes and formats data Detects and corrects problems FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA What does a Network Do? Provides communication which is: Reliable Fair Efficient [15.14] Allows communication between applications (Allows arbitrary applications to communicate via Network (Distributed) Programming) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Network Efficiency Delay Propagation Delay Switching Delay Access Delay Queuing Delay Throughput Rate of Data Transmission How many bits can enter (or leave) network in fixed unit of time Effective Throughput Capacity Congestion Degree of Utilization FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

What Does a Network Do? (continued) Automatically detects and corrects Data corruption (e.g. CRC [7.9, 7.10]) Data loss Duplication Out-of-order delivery e.g., sequencing [16.10] Automatically finds optimal path from source to destination, routing [Ch. 13] FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Network (Distributed) Programming [Ch. 3] Networks allow arbitrary applications to communicate Programmer does not need to understand network technologies Network facilities are accessed through an Application Program Interface (API) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Basic Paradigm for Pairwise Internet Communication Establish contact Exchange data (bi-directional) Terminate contact Note: NO data processing by the network FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Establishing Contact Performed by pair of applications One application waits for contact (called server) Other application initiates contact (called client) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Identifying a Waiting Application Conceptually two items specified Computer Application on that computer Terminology Computer identified by domain name Application identified by program name FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Representations and Translations Humans use names such as computer: www.netbook.cs.purdue.edu application: ftp Network protocols require binary values Library routines exist to translate from names to numbers FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Example API FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Simplified API FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The Await_Contact Function connection await_contact(appnum a) The argument specifies a number that identifies the server application FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The Make_Contact Function connection make_contact(computer c, appnum a) The client uses the return value, which is of type connection, to transfer data FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The appname_to_appnum Function appnum appname_to appnum(char *a) Clients and servers both use appname_to_appnum to translate from a human-readable name for a service to an internal binary value FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The Cname_to_comp Function computer cname_to_comp(char *c) Clients call cname_to_comp convert from a human-readable computer name to the internal binary value FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The Send Function int send (connection con, char *buffer, int length, int flags) Both clients and servers use send to transfer data across the network FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The Recv And Recvln Functions int recv (connection con, char *buffer, int length, int flags) Both clients and servers use recv to access data that arrives across the network int recvln (connection con, char *buffer, int length) Recvln repeatedly calls recv until an entire line of test has been received FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) The Send_eof Function int send_eof (connection con) Both the client and server must use send_eof after sending data to inform the other side that no further transmission will occur FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Simplified API (Cont’d) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Conceptual Client-Server Map FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Example #1: Echo Useful for network testing Server returns exact copy of data sent User on computer X runs echoserver 22000 User on another computer runs echoclient X 22000 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Example Code Using API: Echoserver FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Echoserver (Cont’d) Actually works on the Internet API calls replace conventional I/O No networking knowledge required FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Example #2: Chat Miniature version of Internet chat service Allows two users to communicate User on computer X runs chatserver 25000 User on another computer runs chatclient X 25000 FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Example Application: Web Server User on computer X runs webserver 27000 User on another computer runs browser and enters URL: http://X:27000/index.html FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Example Code Using API: Webserver FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Webserver (2 of 6) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Webserver (3 of 6) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Webserver (4 of 6) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Webserver (5 of 6) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Webserver (6 of 6) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Network Programming in Java The java.net package provides two classes--Socket and ServerSocket--that implement the client side of the connection and the server side of the connection, respectively. java.io package also has to be used together with socket API. FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Example API in Java (v1.3+) FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

Example Code Using Java API: (1) EchoServer.java import java.io.*; import java.net.*; public class EchoServer {     public static void main(String args[]) { // declare a server socket and a client socket for the server ServerSocket echoServer = null; String line; BufferedReader br; PrintStream os; Socket clientSocket = null; // open a server socket on a specfic port. args[0] is the port number try { echoServer = new ServerSocket(Integer.parseInt(args[0])); } catch (IOException e) { } FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA EchoServer.java (2 of 2) try { // open a socket to listen and accept connections from client clientSocket = echoServer.accept(); br = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); os = new PrintStream(clientSocket.getOutputStream()); // once receiving data from client, echo it back to the client. while (true) { line = br.readLine(); os.println(line); } } catch (IOException e) { } }//EchoServer.java FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA (2) EchoClient.java import java.io.*; import java.net.*; public class EchoClient { public static void main(String[] args) throws IOException { Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; //open a socket to a specified host and port. try { // args[0] is host address, args[1] is port number echoSocket = new Socket(args[0], Integer.parseInt(args[1])); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( echoSocket.getInputStream())); } catch (Exception e) {} FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

(2) EchoClient.java (2 of 2) BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; //send user's input to server, and retrieve what the server sends back. while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); } //close everything gracefully out.close(); in.close(); stdIn.close(); echoSocket.close(); }//EchoClient.java FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA (3) Test Run 1. Compile EchoServer.java and EchoClient.java. 2. Start server program: java EchoServer localhost 4118 3. Start client program: java EchoClient 4118 Then type in something at prompt to see what will happen. FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Summary Studying networks is important because The world is interconnected Applications now operate in a distributed environment This course Covers networking and internetworking Explains the mystery Will be hard work FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA

CSI 4118 – UNIVERSITY OF OTTAWA Summary (continued) Computer networks Deliver data from source to destination Automatically find optimal paths Handle problems that occur FALL 2003 CSI 4118 – UNIVERSITY OF OTTAWA