Socket programming. Complement for the programming assignment INFO-0010

Size: px
Start display at page:

Download "Socket programming. Complement for the programming assignment INFO-0010"

Transcription

1 Socket programming Complement for the programming assignment INFO-0010

2 Outline Socket definition Briefing on the Socket API A simple example in Java Multi-threading and Synchronization Example : HTTP protocol Debugging tools Project overview

3 What are sockets? Interface to network protocol stack Typically to transport layer Connectionless (Datagram) Socket Connection-Oriented Socket Transport (UDP and TCP) Network Data Link (MAC / LLC) Physical (PHY)

4 What are sockets? (2) A socket is an end-point of communication which identifies a local process at one end of a communication association A socket is a half association { protocol, local-address, local-port A communication association is identified by two half associations { protocol, local-address, local-port, remote-address, remote-port

5 Communication models Datagrams (UDP) Message-oriented Connectionless Unreliable No congestion control Connections (TCP) Stream-oriented Requires a connection Reliable (no packet loss, no reordering) Congestion control Raw For trafic generation/capture

6 UDP vs TCP Conceptually: Application 1000 bytes Sent datagram = received datagram 1000 bytes Application Socket Network Socket Host1 No congestion control No reordering Packet loss Host2 UDP

7 UDP vs TCP Conceptually: Application 1000 bytes Stream oriented: - May require multiple reads - Order preserved - No loss 512 bytes 488 bytes Application Socket Network Socket Waiting for more flush() (congestion) Host1 Host2 TCP

8 Connections Implemented by TCP Reliable stream transfer Chunks read may be different from chunks sent But streams are identical Guarantees delivery and ordering provided connection not broken Does congestion control What you have sent to the socket may not have left the box yet! You can use out.flush() to force it Programmer must check how many bytes should be read Convention or application protocol header InputStream can provide readfully()

9 Sockets' life cycle (syscalls)

10 Socket's life cycle (Java)

11 Simple example : client/server chat telnet towards a well-known server, from each client The server duplicates each incoming message to all the clients.

12 The Client Side a bot import java.i o.*; import java.net.*; class Bot { Use explicit variable names. We mainly focus on the class names in this example. public static void main (String argv [ ] ) throws Exception { Socket s = new Socket ( "localhost",8086) ; OutputStream out = s.getoutputstream () ; InputStream in = s.getinputstream () ; byte msg[ ] = new byte [64] ; out.write ("ANnA joined the channel".getbytes () ) ; while ( true ) { s.close ( ) ; if (in.read(msg) <=0) break ; if (new String(msg).startsWith("ANnA") ) main() should always catch exceptions. Would only make the code harder to read in this example. out.write( "ANnA feels fine, thanks.\n". getbytes ( ) ) ;

13 The Server Side Incoming Connection class Server { public static void main ( String argv [ ] ) throws Exception { ServerSocket ss = new ServerSocket (8086) ; while ( true ) { Socket ts = ss.accept () ; OutputStream out = ts.getoutputstream() ; InputStream in = ts.getinputstream() ; out.write("hello, this is the echo server". getbytes()) ; byte msg [ ] = new byte [64] ; while ( true ) { int len= in.read(msg); // get bytes (max 64) if (len <=0) break ; // connection closed by peer? out.write(msg,0,len); // send them away. out.flush(); // don t wait for more. ts.close (); What if multiple clients connect simultaneously?

14 The Server Side multithreading class Server { public static void main ( String argv [ ] ) throws Exception { ServerSocket ss = new ServerSocket (8086) ; while ( true ) { Socket ts = ss.accept () ; Worker w = new Worker(ts); w.start(); //Worker extends Thread We spawn a thread every time a connection arrives That fresh-new thread will deal with the new client. And the main thread can return to the welcoming of incoming clients.

15 The Server Side defining a thread class Worker extends Thread { Socket s ; Worker ( Socket _s ) { s = _s public void run ( ) { try { OutputStream out = s.getoutputstream() ; InputStream in = s.getinputstream() ; out.write("hello, this is the echo server". getbytes()) ; byte msg [ ] = new byte [64] ; while ( true ) { int len= in.read(msg); // get bytes (max 64) if (len <=0) break ; // connection closed by peer? out.write(msg,0,len); // send them away. out.flush(); // don t wait for more. s.close (); //acknowledge end of connection catch ( Exception any ) { System.err.println("worker died " + any) ;

16 Extending the "Thread" class One way to create thread in Java 1. Define class that extends class called java.lang.thread 2. Create object of that class Must override the public void run ( ); method and state so by in the method signature to prevent a warning

17 Implementing the Runnable interface Another way to create thread in Java 1. Define class that implements interface called java.lang.runnable 2. Create object of class Thread, passing object of above class to Thread constructor N.B. an interface is like a class with method signatures but no method implementations implementing interface is like extending class But, in addition, must provide implementations of all method signatures in specified interface In Runnable there s only one signature public void run ( );

18 Shared objects What if some objects need to be manipulated by different threads? For instance, we could keep a list (e.g. ArrayList) of all the OutputSteam and turn the "echo" server into a real chat server. Multiple threads will use elements of the list simultaneously Execution is concurrent and non-atomic Consistency is thus not ensured Solution: only one thread at a time can use the elements in the list Deem the sending phase a critical section Implement mutual exclusion over critical section i.e. prevent multiple threads from entering at once

19 The Server Side shared objects // all is just an ArrayList where each OutputStream is.add() ed // out is the OutputStream corresponding to the Socket from which we are receiving void send ( byte msg [ ], int len ) throws Exception { synchronized ( all ) { for ( Enumeration e = all.elements ( ) ; e.hasmoreelements() ; ) { OutputStream o = (OutputStream ) e.nextelement() ; if ( o!= out ) { o.write(msg,0, len ) ; // send them away. o.flush(); // don t wait for more.

20 Example : The HTTP protocol GET /index.html HTTP/1.1 [request headers] client HTTP/ OK [response headers] <html> <body> </body></html> server Applicative protocol over TCP. Retrieve resources (files, web pages) on a machine Text-oriented protocol (vs. e.g. binary BitTorrent) Options (content-type, length, etc) : cf RFC2616

21 A few debugging tools telnet (for direct connection) Each bug has its proper catcher. So, use catch and printstacktrace( ) wisely!

22 strace enetwork f java Server Pid 4199 System calls

23 strace enetwork f java Server Pid 4199 Pid 4211 Socket N 5 = new ServerSocket(8086) # bytes to send # bytes handled by TCP

24 Some command lines (examples are better commented on the web). javac t1.java to compile java Server to launch telnet localhost 8086 to test strace -e trace=network -f java Server to track system calls issued by your program netstat -tlp to list server sockets netstat -tcp to list running connections. curl -I shows the headers for a HEAD method curl dumps URL content on standard output.

25 Guidelines for programming assignment #1 INFO /

26 Context You will develop a client/server application in order to play Guess Who. Java (1.8) Sockets. Console input/output (no fancy GUI). Imposed protocol. To be realized alone. HARD deadline : March, 24th, 2017 img src :

27 Game rules 1. A character is selected at random (for instance, Megan). 2. User asks for clues (including Name) that can be answered only by a yes or no answer (e.g. "is he/she wearing a hat?"). 3. The answer is provided to the question (yes or no). 4. If the user guessed the character correctly, go to 5, otherwise go to Game over. User wants a new game? Go to 1, otherwise, quit.

28 Architecture 5. Updates output 4. Sends response, e.g.: "1 1 3 Yes" 3. Finds answer to the question 1. Creates a question, e.g. "Does he/she have blond hair?" 2. Sends request, e.g.: " hair=blond" Img src for Host and server from GNS3.

29 Guess Who Protocol (GWP)

30 (Un)intentional malevolence What happens if I send "1 5 0", "1 1 0" or "2 0 0"? Good behaviour : Send " Bad Request". Bad behaviour : Anything else. Worst case : Trigger exception. Never expect, always check! What happens if I send "1 1 10"? (not for INFO ) Server waits for the rest of the request, that never comes. If single-threaded, cannot handle new connections. One thread for new connections, then one thread per connection. Use Socket time-outs, close connection if too long (~ 20 seconds).

31 Extra guidelines List of characters imposed, see.csv file Port number : 20xx, where xx = group ID on submission platform Class named "GuessWhoClient" and "GuessWhoServer". Boolean variable inside "GuessWhoServer.java", named isbeingevaluated, set to false by default, which, when set to true, will make the server always select the first character (Megan). No "package" instruction, no shutdown hooks, limited libraries for import, no file manipulation. Fully functional on student machines (ms8**.montefiore.ulg.ac.be). Short report. Send submission to Montefiore Submission Platform (submit.run.montefiore.ulg.ac.be) before March, 24th 2017!

32 Automatic testing Provided jar file for automatic testing

Assignment, part1: feedback and common mistakes. INFO-0010 Samuel HIARD

Assignment, part1: feedback and common mistakes. INFO-0010 Samuel HIARD Assignment, part1: feedback and common mistakes INFO-0010 Samuel HIARD Grades? Not yet Work done at ~70-80% ETA : First week after Spring holidays (should be) Content of the presentation The code of all

More information

COMP 213. Advanced Object-oriented Programming. Lecture 20. Network Programming

COMP 213. Advanced Object-oriented Programming. Lecture 20. Network Programming COMP 213 Advanced Object-oriented Programming Lecture 20 Network Programming Network Programming A network consists of several computers connected so that data can be sent from one to another. Network

More information

Introduction to computer networking

Introduction to computer networking Introduction to computer networking First part of the assignment Academic year 2017-2018 Abstract In this assignment, students will have to implement a client-server application using Java Sockets. The

More information

Java Support for developing TCP Network Based Programs

Java Support for developing TCP Network Based Programs Java Support for developing TCP Network Based Programs 1 How to Write a Network Based Program (In Java) As mentioned, we will use the TCP Transport Protocol. To communicate over TCP, a client program and

More information

CS September 2017

CS September 2017 Machine vs. transport endpoints IP is a network layer protocol: packets address only the machine IP header identifies source IP address, destination IP address Distributed Systems 01r. Sockets Programming

More information

JAVA Network API. 2 - Connection-Oriented vs. Connectionless Communication

JAVA Network API. 2 - Connection-Oriented vs. Connectionless Communication JAVA Network API To be discussed 1 - java.net... 1 2 - Connection-Oriented vs. Connectionless Communication... 1 3 - Connectionless:... 1 4 - Networking Protocols... 2 5 - Sockets... 2 6 - Multicast Addressing...

More information

Introduction to Socket Programming

Introduction to Socket Programming Introduction to Socket Programming (Advanced Computer Networks) By Priyank Shah NET ID : pss160530 A Simple Question What are Sockets? Sockets are communication points on the same or different computers

More information

Advanced Java Programming. Networking

Advanced Java Programming. Networking Advanced Java Programming Networking Eran Werner and Ohad Barzilay Tel-Aviv University Advanced Java Programming, Spring 2006 1 Overview of networking Advanced Java Programming, Spring 2006 2 TCP/IP protocol

More information

Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment

Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment Data Communication EDA344, DIT420 Description of Lab 1 and Optional Programming HTTP Assignment Aras Atalar Prajith R G 24/01/2018 Overview Lab 1 (Compulsory): WIRESHARK lab General Description Programming

More information

Transport Layer. Chapter 3: Transport Layer

Transport Layer. Chapter 3: Transport Layer Transport Layer EECS 3214 Slides courtesy of J.F Kurose and K.W. Ross, All Rights Reserved 29-Jan-18 1-1 Chapter 3: Transport Layer our goals: understand principles behind layer services: multiplexing,

More information

Connecting to a Server Implementing Servers Making URL Connections Advanced Socket Programming

Connecting to a Server Implementing Servers Making URL Connections Advanced Socket Programming Course Name: Advanced Java Lecture 11 Topics to be covered Connecting to a Server Implementing Servers Making URL Connections Advanced Socket Programming Introduction Internet and WWW have emerged as global

More information

CSC 4900 Computer Networks: Transport Layer

CSC 4900 Computer Networks: Transport Layer CSC 4900 Computer Networks: Transport Layer Professor Henry Carter Fall 2017 Last Time... Sockets programming API TCP and UDP look different. Remember, there is no connect() in UDP - just start sending

More information

protocols September 15,

protocols  September 15, Contents SCI 351 4 Protocols, WWW Internet applications WWW, document technology Lennart Herlaar Original slides by Piet van Oostrum September 15, 2003 SCI351-4 1 X SCI351-4 1 X Internet applications How

More information

CSCD 330 Network Programming

CSCD 330 Network Programming CSCD 330 Network Programming Lecture 9 Transport Layer Winter 2019 Reading: Begin Chapter 3 Some Material in these slides from J.F Kurose and K.W. Ross All material copyright 1996-2007 1 Outline Overview

More information

Distributed Systems Recitation 2. Tamim Jabban

Distributed Systems Recitation 2. Tamim Jabban 15-440 Distributed Systems Recitation 2 Tamim Jabban Agenda Communication via Sockets in Java (this enables you to complete PS1 and start P1 (goes out today!)) Multi-threading in Java Coding a full Client-Server

More information

CS 4390 Computer Networks. Transport Services and Protocols

CS 4390 Computer Networks. Transport Services and Protocols CS 4390 Computer Networks UT D data Session 07 Transport Layer Overview and UDP Adapted from Computer Networking a Top-Down Approach 1996-2012 by J.F Kurose and K.W. Ross, All Rights Reserved Transport

More information

OBJECT ORIENTED PROGRAMMING

OBJECT ORIENTED PROGRAMMING 1 OBJECT ORIENTED PROGRAMMING Lecture 14 Networking Basics Outline 2 Networking Basics Socket IP Address DNS Client/Server Networking Class & Interface URL Demonstrating URL Networking 3 Java is practically

More information

C19: User Datagram and Multicast

C19: User Datagram and Multicast CISC 3120 C19: User Datagram and Multicast Hui Chen Department of Computer & Information Science CUNY Brooklyn College 4/18/2018 CUNY Brooklyn College 1 Outline Recap Network fundamentals IPv4, IPv6 addresses

More information

Outlines. Networking in Java. Internet hardware structure. Networking Diagram. IP Address. Networking in Java. Networking basics

Outlines. Networking in Java. Internet hardware structure. Networking Diagram. IP Address. Networking in Java. Networking basics G52APR Application programming Networking in Java Michael Li http://www.cs.nott.ac.uk/~jwl/g52apr Outlines Networking basics Network architecture IP address and port Server-client model TCP and UDP protocol

More information

Multi-threaded Web Server (Assignment 1) Georgios Georgiadis

Multi-threaded Web Server (Assignment 1) Georgios Georgiadis Multi-threaded Web Server (Assignment 1) Georgios Georgiadis Overview Multi-threaded Web Server What to do and how to do it HTTP messages Processes and threads ComputerComm '09 2 Multi-threaded Web Server

More information

Chapter 3 Transport Layer

Chapter 3 Transport Layer Chapter 3 Transport Layer Lec 8: Transport Layer Service Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 All material copyright 1996-2012 J.F Kurose

More information

Chapter 11. Application-Layer Elements Ports

Chapter 11. Application-Layer Elements Ports Chapter 11 Application-Layer Elements 11.1 Ports........................... 93 11.2 Sockets.......................... 95 11.2.1 Socket Domains, Types and Protocols....... 95 11.2.2 Operations on Sockets................

More information

Internet Technology 2/7/2013

Internet Technology 2/7/2013 Sample Client-Server Program Internet Technology 02r. Programming with Sockets Paul Krzyzanowski Rutgers University Spring 2013 To illustrate programming with TCP/IP sockets, we ll write a small client-server

More information

CSC 4900 Computer Networks: P2P and Sockets

CSC 4900 Computer Networks: P2P and Sockets CSC 4900 Computer Networks: P2P and Sockets Professor Henry Carter Fall 2017 Recap SMTP is the language that mail servers use to exchange messages. SMTP is push-based... why? You can run SMTP from a telnet

More information

Networking, Java threads and synchronization. PRIS lecture 4 Fredrik Kilander

Networking, Java threads and synchronization. PRIS lecture 4 Fredrik Kilander Networking, Java threads and synchronization PRIS lecture 4 Fredrik Kilander OSI Application Presentation Session Transport Network Data link Physical TCP/IP Application Transport Internet Host-to-network

More information

Different Layers Lecture 21

Different Layers Lecture 21 Different Layers Lecture 21 10/17/2003 Jian Ren 1 The Transport Layer 10/17/2003 Jian Ren 2 Transport Services and Protocols Provide logical communication between app processes running on different hosts

More information

Assignment, part 2. Statement and concepts INFO-0010

Assignment, part 2. Statement and concepts INFO-0010 Assignment, part 2 Statement and concepts INFO-0010 Outline Statement Implementation of concepts Objective Mastermind game using HTTP GET and HTTP POST methods The platform Architecture Root page ("/")

More information

Networking Basics. network communication.

Networking Basics. network communication. JAVA NETWORKING API Networking Basics When you write Java programs that communicate over the network, you are programming at the application layer. Typically, you don't need to concern yourself with the

More information

CSCE 463/612 Networks and Distributed Processing Spring 2018

CSCE 463/612 Networks and Distributed Processing Spring 2018 CSCE 463/612 Networks and Distributed Processing Spring 2018 Introduction Dmitri Loguinov Texas A&M University January 23, 2018 Original slides copyright 1996-2004 J.F Kurose and K.W. Ross 1 Updates Recv

More information

Joseph Faber Wonderful Talking Machine (1845)

Joseph Faber Wonderful Talking Machine (1845) Joseph Faber Wonderful Talking Machine (1845) Connected World Human-to-Human communication Human-Machine interaction Machine-to-Machine communication (M2M) Internet-of-Things (IOT) Internet of Things How

More information

Network Programming. Introduction to Sockets. Dr. Thaier Hayajneh. Process Layer. Network Layer. Berkeley API

Network Programming. Introduction to Sockets. Dr. Thaier Hayajneh. Process Layer. Network Layer. Berkeley API Network Programming Outline Definitions Dr. Thaier Hayajneh Computer Engineering Department Berkeley API Socket definition and types Introduction to Sockets 1 2 Process Process Process Layer TCP SCTP UDP

More information

JAVA SOCKET PROGRAMMING

JAVA SOCKET PROGRAMMING JAVA SOCKET PROGRAMMING WHAT IS A SOCKET? Socket The combination of an IP address and a port number. (RFC 793 original TCP specification) The name of the Berkeley-derived application programming interfaces

More information

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries 1 CONTENTS 1. Introduction to Java 2. Holding Data 3. Controllin g the f l o w 4. Object Oriented Programming Concepts 5. Inheritance & Packaging 6. Handling Error/Exceptions 7. Handling Strings 8. Threads

More information

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol Transport Layer Transport Layer The transport layer is responsible for the delivery of a message from one process to another Types of Data Deliveries Client/Server Paradigm An application program on the

More information

Chapter 7 Transport Layer. 7.0 Introduction 7.1 Transport Layer Protocols 7.2 TCP and UDP 7.3 Summary

Chapter 7 Transport Layer. 7.0 Introduction 7.1 Transport Layer Protocols 7.2 TCP and UDP 7.3 Summary Chapter 7 Transport Layer 7.0 Introduction 7.1 Transport Layer Protocols 7.2 TCP and UDP 7.3 Summary Transport Layer Transportation of Data Role of the Transport Layer The transport layer is responsible

More information

Workbook A dialog box will appear asking for you to select your "workspace". Leave the default as is, which should be /home/crsid/workspace.

Workbook A dialog box will appear asking for you to select your workspace. Leave the default as is, which should be /home/crsid/workspace. In this workbook you will learn how to use Eclipse as a development environment for Java programs. Using Eclipse, you will then write a simple Java messaging client which will allow you to send and receive

More information

CSEN 503 Introduction to Communication Networks. Mervat AbuElkheir Hana Medhat Ayman Dayf. ** Slides are attributed to J. F.

CSEN 503 Introduction to Communication Networks. Mervat AbuElkheir Hana Medhat Ayman Dayf. ** Slides are attributed to J. F. CSEN 503 Introduction to Communication Networks Mervat AbuElkheir Hana Medhat Ayman Dayf ** Slides are attributed to J. F. Kurose Chapter 3 outline Transport-layer services Multiplexing and demultiplexing

More information

Pieter van den Hombergh Richard van den Ham. March 17, 2018

Pieter van den Hombergh Richard van den Ham. March 17, 2018 : Network : Network, Object Pieter van den Hombergh Richard van den Ham Fontys Hogeschool voor Techniek en Logistiek March 17, 2018 /FHTenL : Network March 17, 2018 1/21 Topics, Object Some everyday life

More information

Different Layers Lecture 20

Different Layers Lecture 20 Different Layers Lecture 20 10/15/2003 Jian Ren 1 The Network Layer 10/15/2003 Jian Ren 2 Network Layer Functions Transport packet from sending to receiving hosts Network layer protocols in every host,

More information

Interprocess Communication

Interprocess Communication Interprocess Communication Nicola Dragoni Embedded Systems Engineering DTU Informatics 4.2 Characteristics, Sockets, Client-Server Communication: UDP vs TCP 4.4 Group (Multicast) Communication The Characteristics

More information

Software Practice 1 - Socket

Software Practice 1 - Socket Software Practice 1 - Socket Terms of socket programming Socket Implementation (TCP, UDP) Socket with multithread Serialization Lab practice Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim T.A. Sujin

More information

Internet Protocol. Chapter 5 Protocol Layering. Juho Kim Graduate School of Information & Technology Sogang University

Internet Protocol. Chapter 5 Protocol Layering. Juho Kim Graduate School of Information & Technology Sogang University Internet Protocol Chapter 5 Protocol Layering Juho Kim Graduate School of Information & Technology Sogang University Department of of Computer Science and and Engineering, Sogang University Page 1 CAD

More information

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

Transport Layer. Gursharan Singh Tatla.   Upendra Sharma. 1 Transport Layer Gursharan Singh Tatla mailme@gursharansingh.in Upendra Sharma 1 Introduction The transport layer is the fourth layer from the bottom in the OSI reference model. It is responsible for message

More information

Outline. Inter-Process Communication. IPC across machines: Problems. CSCI 4061 Introduction to Operating Systems

Outline. Inter-Process Communication. IPC across machines: Problems. CSCI 4061 Introduction to Operating Systems Outline CSCI 4061 Introduction to Operating Systems ing Overview Layering and Protocols TCP/IP Protocol Family Client-Server Model Instructor: Abhishek Chandra 2 Inter-Process Communication Intra-node:

More information

Application Layer Introduction; HTTP; FTP

Application Layer Introduction; HTTP; FTP Application Layer Introduction; HTTP; FTP Tom Kelliher, CS 325 Feb. 4, 2011 1 Administrivia Announcements Assignment Read 2.4 2.6. From Last Time Packet-switched network characteristics; protocol layers

More information

TCP and Concurrency. The third assignment at DA

TCP and Concurrency. The third assignment at DA TCP and Concurrency The third assignment at DA2402 2009-03-05 Jonas Lundberg/Ola Flygt adapted to Java by Marcus Edvinsson maintained by Marcus Edvinsson Matematiska och systemtekniska institutionen, MSI

More information

Chapter 3 Transport Layer

Chapter 3 Transport Layer Chapter 3 Transport Layer A note on the use of these Powerpoint slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you see the animations;

More information

The TCP Protocol Stack

The TCP Protocol Stack The TCP Protocol Stack Michael Brockway February 16, 2018 Introduction - Layered archtecture Networking software is desgined in a layered fashion The bottom layer is the services offered by the underlying

More information

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions CMSC 330: Organization of Programming Languages Multithreaded Programming Patterns in Java CMSC 330 2 Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to

More information

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets

More information

Info 408 Distributed Applications programming 2 nd semester of 2017/2018 Credits: 5 Lecturer: Dr. Antoun Yaacoub

Info 408 Distributed Applications programming 2 nd semester of 2017/2018 Credits: 5 Lecturer: Dr. Antoun Yaacoub Lebanese University Faculty of Science I Master 1 degree Computer Science Info 408 Distributed Applications programming 2 nd semester of 2017/2018 Credits: 5 Lecturer: Dr. Antoun Yaacoub Starting Network

More information

: Distributed Systems Principles and Paradigms Assignment 1 Multithreaded Dictionary Server

: Distributed Systems Principles and Paradigms Assignment 1 Multithreaded Dictionary Server 433 652: Distributed Systems Principles and Paradigms Assignment 1 Multithreaded Dictionary Server Problem Description Using a client server architecture, design and implement a multi threaded server that

More information

Computer Networks - A Simple HTTP proxy -

Computer Networks - A Simple HTTP proxy - Computer Networks - A Simple HTTP proxy - Objectives The intent of this assignment is to help you gain a thorough understanding of: The interaction between browsers and web servers The basics of the HTTP

More information

Networking and Security

Networking and Security Chapter 03 Networking and Security Mr. Nilesh Vishwasrao Patil Government Polytechnic Ahmednagar Socket Network socket is an endpoint of an interprocess communication flow across a computer network. Sockets

More information

CSE 461 Module 11. Connections

CSE 461 Module 11. Connections CSE 461 Module 11 Connections This Time More on the Transport Layer Focus How do we connect processes? Topics Naming processes Connection setup / teardown Flow control Application Presentation Session

More information

CSE 461 Module 10. Introduction to the Transport Layer

CSE 461 Module 10. Introduction to the Transport Layer CSE 461 Module 10 Introduction to the Transport Layer Last Time We finished up the Network layer Internetworks (IP) Routing (DV/RIP, LS/OSPF, BGP) It was all about routing: how to provide end-to-end delivery

More information

CSC 401 Data and Computer Communications Networks

CSC 401 Data and Computer Communications Networks CSC 401 Data and Computer Communications Networks Transport Layer Intro, Mutliplexing/Demultiplexing, UDP Sec 3.1 3.4 Prof. Lina Battestilli Fall 2017 Chapter 3: Transport Layer our goals: understand principles

More information

Merge Sort Quicksort 9 Abstract Windowing Toolkit & Swing Abstract Windowing Toolkit (AWT) vs. Swing AWT GUI Components Layout Managers Swing GUI

Merge Sort Quicksort 9 Abstract Windowing Toolkit & Swing Abstract Windowing Toolkit (AWT) vs. Swing AWT GUI Components Layout Managers Swing GUI COURSE TITLE :Introduction to Programming 2 COURSE PREREQUISITE :Introduction to Programming 1 COURSE DURATION :16 weeks (3 hours/week) COURSE METHODOLOGY:Combination of lecture and laboratory exercises

More information

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data ELEX 4550 : Wide Area Networks 2015 Winter Session UDP and TCP is lecture describes the two most common transport-layer protocols used by IP networks: the User Datagram Protocol (UDP) and the Transmission

More information

CMSC 332 Computer Networks Transport Layer

CMSC 332 Computer Networks Transport Layer CMSC 332 Computer Networks Transport Layer Professor Szajda Announcements Project I - I ll test against various clients (still possibly an issue in spec). Project 2 will be posted soon (but first, I want

More information

OSI Transport Layer. Network Fundamentals Chapter 4. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1

OSI Transport Layer. Network Fundamentals Chapter 4. Version Cisco Systems, Inc. All rights reserved. Cisco Public 1 OSI Transport Layer Network Fundamentals Chapter 4 Version 4.0 1 Transport Layer Role and Services Transport layer is responsible for overall end-to-end transfer of application data 2 Transport Layer Role

More information

CN1047 INTRODUCTION TO COMPUTER NETWORKING CHAPTER 6 OSI MODEL TRANSPORT LAYER

CN1047 INTRODUCTION TO COMPUTER NETWORKING CHAPTER 6 OSI MODEL TRANSPORT LAYER CN1047 INTRODUCTION TO COMPUTER NETWORKING CHAPTER 6 OSI MODEL TRANSPORT LAYER Transport Layer The Transport layer ensures the reliable arrival of messages and provides error checking mechanisms and data

More information

CSc 450/550 Computer Networks Network Architectures & Client-Server Model

CSc 450/550 Computer Networks Network Architectures & Client-Server Model CSc 450/550 Computer Networks Network Architectures & Client-Server Model Jianping Pan Summer 2007 5/17/07 CSc 450/550 1 Last lectures So far, nuts and bolts views of the Internet Internet evolution and

More information

Transport Layer (TCP/UDP)

Transport Layer (TCP/UDP) Transport Layer (TCP/UDP) Where we are in the Course Moving on up to the Transport Layer! Application Transport Network Link Physical CSE 461 University of Washington 2 Recall Transport layer provides

More information

Outline of Topics. UDP Socket Java Programming. Multicast in Java. Real-time protocol (RTP) XMPP and Jingle protocols. Java I/O and New IO (NIO)

Outline of Topics. UDP Socket Java Programming. Multicast in Java. Real-time protocol (RTP) XMPP and Jingle protocols. Java I/O and New IO (NIO) Outline Outline of Topics UDP Socket Java Programming Multicast in Java Real-time protocol (RTP) XMPP and Jingle protocols Java I/O and New IO (NIO) UDP Socket Java Programming User Datagram Protocol (UDP)

More information

Assignment 2 CISC 650 Computer Networks Fall 2016 Due Date: 10/9/ :59PM ET Total Points: 100

Assignment 2 CISC 650 Computer Networks Fall 2016 Due Date: 10/9/ :59PM ET Total Points: 100 Nova Southeastern University College of Engineering and Computing Assignment 2 CISC 650 Computer Networks Fall 2016 Due Date: 10/9/2016 11:59PM ET Total Points: 100 Note: Please include your name and the

More information

Practical Session #09 Exceptions & Networking. Tom Mahler

Practical Session #09 Exceptions & Networking. Tom Mahler Practical Session #09 Exceptions & Networking Tom Mahler 1 In This Recitation We ll Cover Exceptions Java Sockets Datagram vs. Stream The Client-Server Model 2 Exceptions 3 Exceptions Java uses exceptions

More information

Web Technology. COMP476 Networked Computer Systems. Hypertext and Hypermedia. Document Representation. Client-Server Paradigm.

Web Technology. COMP476 Networked Computer Systems. Hypertext and Hypermedia. Document Representation. Client-Server Paradigm. Web Technology COMP476 Networked Computer Systems - Paradigm The method of interaction used when two application programs communicate over a network. A server application waits at a known address and a

More information

CSC Systems Programming Fall Lecture - XXIII Final Review. Tevfik Koşar. Louisiana State University

CSC Systems Programming Fall Lecture - XXIII Final Review. Tevfik Koşar. Louisiana State University CSC 4304 - Systems Programming Fall 2008 Lecture - XXIII Final Review Tevfik Koşar Louisiana State University December 4 th, 2008 1 Using make 2 Implicit Rules 3 Using Variables in Makefiles 4 Libraries

More information

Using make. Using Variables in Makefiles. Implicit Rules. Static vs Dynamic Libraries. Libraries. Tevfik Ko!ar

Using make. Using Variables in Makefiles. Implicit Rules. Static vs Dynamic Libraries. Libraries. Tevfik Ko!ar CSC 4304 - Systems Programming Fall 2008 Using make Lecture - XXIII Final Review Tevfik Ko!ar Louisiana State University December 4 th, 2008 1 2 Implicit Rules Using Variables in Makefiles 3 4 Libraries

More information

QUIZ: Longest Matching Prefix

QUIZ: Longest Matching Prefix QUIZ: Longest Matching Prefix A router has the following routing table: 10.50.42.0 /24 Send out on interface Z 10.50.20.0 /24 Send out on interface A 10.50.24.0 /22 Send out on interface B 10.50.20.0 /22

More information

Unix Network Programming

Unix Network Programming Unix Network Programming Remote Communication Dr Hamed Vahdat-Nejad Network Applications Types: Client Server Exampels: A web browser (client) Ap communicating with a Web server An FTP client Fetching

More information

C18: Network Fundamentals and Reliable Sockets

C18: Network Fundamentals and Reliable Sockets CISC 3120 C18: Network Fundamentals and Reliable Sockets Hui Chen Department of Computer & Information Science CUNY Brooklyn College 4/16/2018 CUNY Brooklyn College 1 Outline Networking fundamentals Network

More information

Programming Methods Dr Robert Harle

Programming Methods Dr Robert Harle Programming Methods Dr Robert Harle IA NST CS and CST Lent 2008/09 Handout 4 Our Motivating Example We re going to make the world s simplest web server It s not going to challenge apache etc But it will

More information

Distributed Systems Recitation 2. Tamim Jabban

Distributed Systems Recitation 2. Tamim Jabban 15-440 Distributed Systems Recitation 2 Tamim Jabban Project 1 Involves creating a Distributed File System (DFS) Released yesterday When/If done with PS1, start reading the handout Today: Socket communication!

More information

Requirements. PA4: Multi-thread File Downloader Page 1. Assignment

Requirements. PA4: Multi-thread File Downloader Page 1. Assignment PA4: Multi-thread File Downloader Page 1 Assignment What to Submit Write a program that downloads a file from the Internet using multiple threads. The application has a Graphical Interface written in JavaFX,

More information

CS 10: Problem solving via Object Oriented Programming. Client/Server

CS 10: Problem solving via Object Oriented Programming. Client/Server CS 10: Problem solving via Object Oriented Programming Client/Server Agenda 1. Sockets 2. Server 3. MulAthreaded server 4. Chat server 2 Sockets are a way for computers to communicate IP: 1.2.3.4 HTTP

More information

Application Protocols and HTTP

Application Protocols and HTTP Application Protocols and HTTP 14-740: Fundamentals of Computer Networks Bill Nace Material from Computer Networking: A Top Down Approach, 6 th edition. J.F. Kurose and K.W. Ross Administrivia Lab #0 due

More information

Internet and Intranet Protocols and Applications

Internet and Intranet Protocols and Applications Internet and Intranet Protocols and Applications Lecture 1b: The Transport Layer in the Internet January 17, 2006 Arthur Goldberg Computer Science Department New York University artg@cs.nyu.edu 01/17/06

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page: CSE 3214: Computer Networks Protocols and Applications Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.cse.yorku.ca/course/3214 These slides are

More information

TCP/IP Transport Layer Protocols, TCP and UDP

TCP/IP Transport Layer Protocols, TCP and UDP TCP/IP Transport Layer Protocols, TCP and UDP Learning Objectives Identify TCP header fields and operation using a Wireshark FTP session capture. Identify UDP header fields and operation using a Wireshark

More information

Principles of Software Construction. Introduction to networks and distributed systems School of Computer Science

Principles of Software Construction. Introduction to networks and distributed systems School of Computer Science Principles of Software Construction Introduction to networks and distributed systems Josh Bloch Charlie Garrod School of Computer Science 1 Administrivia Homework 5 Best Frameworks available tonight Or

More information

(Refer Slide Time: 1:09)

(Refer Slide Time: 1:09) Computer Networks Prof. S. Ghosh Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecturer # 30 UDP and Client Server Good day, today we will start our discussion

More information

Java Networking (sockets)

Java Networking (sockets) Java Networking (sockets) Rui Moreira Links: http://java.sun.com/docs/books/tutorial/networking/toc.html#sockets http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets_p.html Networking Computers

More information

CSCD 330 Network Programming

CSCD 330 Network Programming CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Winter 2015 Reading: Chapter 2, Relevant Links Some Material in these slides from J.F Kurose and K.W. Ross All material copyright

More information

Protocols SPL/ SPL

Protocols SPL/ SPL Protocols 1 Application Level Protocol Design atomic units used by protocol: "messages" encoding reusable, protocol independent, TCP server, LinePrinting protocol implementation 2 Protocol Definition set

More information

Java Overview An introduction to the Java Programming Language

Java Overview An introduction to the Java Programming Language Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/

More information

Tommy Färnqvist, IDA, Linköping University

Tommy Färnqvist, IDA, Linköping University Lecture 4 Threads and Networking in Java TDDC32 Lecture notes in Design and Implementation of a Software Module in Java 23 January 2013 Tommy Färnqvist, IDA, Linköping University 4.1 Lecture Topics Contents

More information

1 OBJECT-ORIENTED PROGRAMMING 1

1 OBJECT-ORIENTED PROGRAMMING 1 PREFACE xvii 1 OBJECT-ORIENTED PROGRAMMING 1 1.1 Object-Oriented and Procedural Programming 2 Top-Down Design and Procedural Programming, 3 Problems with Top-Down Design, 3 Classes and Objects, 4 Fields

More information

Web Server Project. Tom Kelliher, CS points, due May 4, 2011

Web Server Project. Tom Kelliher, CS points, due May 4, 2011 Web Server Project Tom Kelliher, CS 325 100 points, due May 4, 2011 Introduction (From Kurose & Ross, 4th ed.) In this project you will develop a Web server in two steps. In the end, you will have built

More information

Data Communication & Computer Networks MCQ S

Data Communication & Computer Networks MCQ S Data Communication & Computer Networks MCQ S 1. The translates internet domain and host names to IP address. a) domain name system b) routing information protocol c) network time protocol d) internet relay

More information

Interprocess Communication Mechanisms

Interprocess Communication Mechanisms Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name

More information

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV

ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV ощ 'ршорвшэш! цвн-эориэу ощ 'sajbpossv # PIPG DUJ 'ssjmoossv ^ PIPG pipa w н OX ЛЮН VAV Contents Preface Chapter 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19

More information

shared storage These mechanisms have already been covered. examples: shared virtual memory message based signals

shared storage These mechanisms have already been covered. examples: shared virtual memory message based signals Interprocess Communication 1 Interprocess Communication Mechanisms shared storage These mechanisms have already been covered. examples: shared virtual memory shared files processes must agree on a name

More information

Lecture 9: Transpor Layer Overview and UDP

Lecture 9: Transpor Layer Overview and UDP Lecture 9: Transpor Layer Overview and UDP COMP 332, Spring 2018 Victoria Manfredi Acknowledgements: materials adapted from Computer Networking: A Top Down Approach 7 th edition: 1996-2016, J.F Kurose

More information

BITS-Pilani Hyderabad Campus

BITS-Pilani Hyderabad Campus BITS-Pilani Hyderabad Campus CS C461/IS C461/CS F303/ IS F303 (Computer Networks) Laboratory 4 Aim: To give an introduction to Socket Programming in TCP and UDP. TCP Socket Programming: A socket is the

More information

CSCD 330 Network Programming Spring 2018

CSCD 330 Network Programming Spring 2018 CSCD 330 Network Programming Spring 2018 Lecture 6 Application Layer Socket Programming in Java Reading for Java Client/Server see Relevant Links Some Material in these slides from J.F Kurose and K.W.

More information

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 4 (document version 1.0) Network Programming using C

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 4 (document version 1.0) Network Programming using C CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Homework 4 (document version 1.0) Network Programming using C Overview This homework is due by 11:59:59 PM on Thursday, April 26, 2018.

More information

Previous lecture: threads G51PRG: Introduction to Programming Second semester Lecture 12 URL

Previous lecture: threads G51PRG: Introduction to Programming Second semester Lecture 12 URL Previous lecture: threads G51PRG: Introduction to Programming Second semester Lecture 12 What is a thread Why use multiple threads Issues and problems involved Java threads Natasha Alechina School of Computer

More information